Skip to content Skip to sidebar Skip to footer

Flask App Will Not Load App.py (the File/path Provided (app) Does Not Appear To Exist)

My flask app is outputting 'no content' for the for() block and i dont know why. I tested my query in app.py , here is app.py: # mysql config app.config['MYSQL_DATABASE_USER'] = 'u

Solution 1:

You haven't got anything in your template called blogposts. You need to use keyword arguments to pass the data:

return render_template('index.html', blogposts=blogposts)

Also note you should really do that query inside the function, otherwise it will only ever execute on process start and you'll always have the same three posts.

Solution 2:

I had same problem. I solved it as change directory of terminal to the folder containing app.py and then run

export FLASK_APP=app.py

then, you should run

python -m flask run

Post a Comment for "Flask App Will Not Load App.py (the File/path Provided (app) Does Not Appear To Exist)"