Can't run main.py
SoxfnLj opened this issue · 2 comments
SoxfnLj commented
Im on the first step in this tutorial, and when I try to run the code, this error message appears, Traceback (most recent call last):
File "c:\Users\LJH20\VSCode\Flask Web App\main.py", line 6, in
app.run(debug=True)
This is the code btw:
main.py:
from website import create_app
app = create_app
if name == 'main':
app.run(debug=True)
init.py:
from flask import Flask
def create_app():
app = Flask(name)
app.config['SECRET_KEY'] = 'This is my Secret Key'
return app
drfq commented
While in the main.py after completing the import the code needs to be changed from:
app = create_app =====> app = create_app()
The "()" is missing and it is necessary in order to properly call the function that creates the app
SoxfnLj commented
OMG this works thank you so much!!