Flask and Heroku - ModuleNotFoundError: No module named 'app'

后端 未结 3 1447
一整个雨季
一整个雨季 2020-12-31 17:08

I\'m trying to deploy a Flask app to Heroku. After deploying, application crashes and I get an error ModuleNotFoundError: No module named \'app\'.

Project structure

3条回答
  •  执念已碎
    2020-12-31 18:01

    In my case, this was resolved after I made the following changes, of course committing the changes before pushing to heroku:

    1) ran pip freeze > requirements.txt,

    2) moved my app.py to a different directory, and updated Procfile, manage.py -all files importing app.py- and to reflect the new location. I'm not sure if moving the file actually made a difference, it seems unlikely, but regardless, it's worth verifying all files that import app have the correct path

提交回复
热议问题