thadeusb / flask-cache

Cache extension for Flask
http://packages.python.org/Flask-Cache/
Other
697 stars 185 forks source link

raise RuntimeError(_app_ctx_err_msg) #164

Open wahello opened 7 years ago

wahello commented 7 years ago

@cache.cache(timeout=60) File "/Users/keyeMyria/workspace/logistics/python/flask/zz56_env/lib/python3.5/site-packages/flask_cache/init.py", line 192, in cache return app.extensions['cache'][self] File "/Users/keyeMyria/workspace/logistics/python/flask/zz56_env/lib/python3.5/site-packages/werkzeug/local.py", line 343, in getattr return getattr(self._get_current_object(), name) File "/Users/keyeMyria/workspace/logistics/python/flask/zz56_env/lib/python3.5/site-packages/werkzeug/local.py", line 302, in _get_current_object return self.__local() File "/Users/keyeMyria/workspace/logistics/python/flask/zz56_env/lib/python3.5/site-packages/flask/globals.py", line 51, in _find_app 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 a way. To solve this set up an application context with app.app_context(). See the documentation for more information.

config is : CACHE_TYPE = 'simple'

Flask==0.12 flask-cache=0.13.1