I have the following app structure:
manage.py
myapp/
__init__.py
config.py
views/
__init__.py
login.py
...
In myapp/__init__.py
I have a function create_app()
which returns the Flask app instance. The config values are also stated in create_app()
too. I would like to be able to access these values in other files such as login.py
. I've tried:
from myapp import create_app as app
print app.config['SECRET_KEY']
However I receive an error stating AttributeError: 'function' object has no attribute 'config'
What am I doing wrong and how can I fix this? Thanks.