Skip to content

Instantly share code, notes, and snippets.

@PeterJCLaw
Last active February 15, 2021 22:50
Show Gist options
  • Save PeterJCLaw/b017b2869590036d3d05a427fd9f34d0 to your computer and use it in GitHub Desktop.
Save PeterJCLaw/b017b2869590036d3d05a427fd9f34d0 to your computer and use it in GitHub Desktop.
Minimal demo of Flask error from Werkzeug 2 change when Sphinx builds docs
/out
/.vscode
#!/bin/sh
python -m sphinx -T -E . out
extensions = [
'sphinx.ext.autodoc',
]
source_suffix = '.rst'
master_doc = 'index'
project = 'demo'
release = '1.0.0'
version = '1.0.0'
from flask import g
<snip>
File "/tmp/venv/lib/python3.8/site-packages/sphinx/util/inspect.py", line 234, in ispartial
return isinstance(obj, (partial, partialmethod))
File "/tmp/venv/lib/python3.8/site-packages/werkzeug/local.py", line 379, in __get__
obj = instance._get_current_object()
File "/tmp/venv/lib/python3.8/site-packages/werkzeug/local.py", line 499, in _get_current_object
return self.__local() # type: ignore
File "/tmp/venv/lib/python3.8/site-packages/flask/globals.py", line 45, in _lookup_app_object
raise RuntimeError(_app_ctx_err_msg)
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
to interface with the current application object in some way. To solve
this, set up an application context with app.app_context(). See the
documentation for more information.

API

.. automodule:: demo
    :members:
    :undoc-members:
    :show-inheritance:
Sphinx
Werkzeug==2.0.0rc1
Flask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment