简体   繁体   中英

Flask with Heroku, Import Error: No module named Flask

So I'm trying to create an app with Flask and Heroku. I can run it with Foreman just fine, but after deploying to Heroku, the application error comes up and the heroku logs show:

heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `python app.py`
app[web.1]:   File "app.py", line 2, in <module>
app[web.1]:     from flask import Flask, send_from_directory
app[web.1]: ImportError: No module named flask

Any idea on how this could happen? Thanks!

EDIT: Flask is in the requirements file and I see that it gets installed during the push to Heroku.

You probably need to add Flask (and any other external dependencies) to a requirements.txt and include it in your repo.

You can use 'pip freeze > requirements.txt" to create it with what ever packages you have installed in your environment at the moment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM