python - “没有名为 'django_heroku' 的模块”应用程序无法在 Heroku 上启动
问题描述
试图推送到heroku服务器,我得到了这个:
git push heroku master
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Python has released a security update! Please consider upgrading to python-3.7.3
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing requirements with pip
remote:
remote: -----> Downloading NLTK corpora…
remote: ! 'nltk.txt' not found, not downloading any corpora
remote: ! Learn more: https://devcenter.heroku.com/articles/python-nltk
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 206.4M
remote: -----> Launching...
remote: Released v10
remote: https://versally.herokuapp.com/ deployed to Heroku
但是,当我转到我的应用程序时,它告诉我有一个错误。当我检查日志时,我看到:
2019-04-30T13:22:00.633794+00:00 app[web.1]: import django_heroku
2019-04-30T13:22:00.633801+00:00 app[web.1]: ModuleNotFoundError: No module named 'django_heroku'
2019-04-30T13:22:00.634020+00:00 app[web.1]: [2019-04-30 13:22:00 +0000] [11] [INFO] Worker exiting (pid: 11)
2019-04-30T13:22:00.789044+00:00 app[web.1]: [2019-04-30 13:22:00 +0000] [4] [INFO] Shutting down: Master
我还没有设置数据库,但我只是想从 django 代码中获取调试消息,这样我就可以开始配置数据库了。
解决方案
对于遇到此问题的任何人,我通过清空我的 requirements.txt、推送(这会迫使 Heroku 卸载所有需求)然后再次推送填充的需求来解决它。
我必须确保 gunicorn 包含在要求中 - 确实如此,但日志显示由于某种原因 heroku 卸载了我的“陈旧”版本。
推荐阅读
- vhdl - 如何从 ZTNQ-7020 开发板读取温度?
- angular - NgModel 正在打印我输入的错误值
- bash - 当时间是一个变量时,如何告诉 VLC 在某个时间点开始播放文件?
- karate - 如何断言其中包含特殊字符的字符串?
- java - 切换帧的最佳做法是什么?
- html - 将 HTML 代码嵌入 Google 协作平台时如何删除向下滚动
- pandas - 尝试使用 pd.read_sas() 方法导入 sav 文件失败
- java - java - 如何使用antlr或javaparser查找将字符串文字分配给Java中变量的所有赋值语句?
- mysql - mysql更新语句未在while循环中设置变量执行
- bash - 添加尾随逗号以确保 .csv 行具有相同的列数