dwu39
dwu39

Reputation: 486

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.

Upvotes: 4

Views: 2592

Answers (1)

Technoloft
Technoloft

Reputation: 649

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.

Upvotes: 1

Related Questions