Flask-Web-App-Tutorial
Flask-Web-App-Tutorial copied to clipboard
No problem!
No problem!
Originally posted by @Bludenz in https://github.com/techwithtim/Flask-Web-App-Tutorial/issues/41#issuecomment-1059731878
Hi I am trying to access the app.config from init.py in views.py but it is not recognising app.config I just want to access the app.config in views.py. Do i need to import something?
in init.py def create_app(): app = Flask(name) app.config['SECRET_KEY'] = 'xftry' app.config['UPLOAD_FOLDER'] = myfolder
In views.py: (not recognising app) f.save(os.path.join(app.config['UPLOAD_FOLDER'], f.filename))
Thank you
Hi. Try importing this in your init.py after referencing the app.config @gemin55
from .views import views
Hope this helps!