Flask-Web-App-Tutorial icon indicating copy to clipboard operation
Flask-Web-App-Tutorial copied to clipboard

No problem!

Open gemin55 opened this issue 2 years ago • 2 comments

No problem!

Originally posted by @Bludenz in https://github.com/techwithtim/Flask-Web-App-Tutorial/issues/41#issuecomment-1059731878

gemin55 avatar Apr 05 '22 05:04 gemin55

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

gemin55 avatar Apr 05 '22 05:04 gemin55

Hi. Try importing this in your init.py after referencing the app.config @gemin55

from .views import views

Hope this helps!

DrashtiSanjayShah avatar Aug 04 '23 07:08 DrashtiSanjayShah