[英]Flask with Heroku, Import Error: No module named Flask
So I'm trying to create an app with Flask and Heroku. 所以我试图用Flask和Heroku创建一个应用程序。 I can run it with Foreman just fine, but after deploying to Heroku, the application error comes up and the heroku logs show: 我可以用Foreman很好地运行它,但是在部署到Heroku之后,出现应用程序错误,并且heroku日志显示:
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. 编辑:Flask在需求文件中,我看到它在推送到Heroku的过程中得到安装。
You probably need to add Flask (and any other external dependencies) to a requirements.txt and include it in your repo. 您可能需要将Flask(以及任何其他外部依赖项)添加到requirements.txt,并将其包含在您的存储库中。
You can use 'pip freeze > requirements.txt" to create it with what ever packages you have installed in your environment at the moment. 您可以使用“ pip Frozen> requirements.txt”来创建当前环境中安装的所有软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.