techwithtim / Flask-Web-App-Tutorial

Code for the note storing flask web app made during a YouTube video.
918 stars 1.01k forks source link

Can't run main.py #149

Closed SoxfnLj closed 6 months ago

SoxfnLj commented 6 months ago

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 6 months ago

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 6 months ago

OMG this works thank you so much!!