“没有名为'django_heroku'的模块的应用程序将不会在Heroku上启动

时间:2019-04-30 14:01:09

标签: python django heroku deployment

尝试推送到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代码中获取调试消息,因此我可以开始配置数据库。

1 个答案:

答案 0 :(得分:0)

对于存在此问题的任何人,我都清空了我的requirements.txt,先推送(这会迫使Heroku卸载所有需求),然后再重新填充填充的需求。

我必须确保需求中包括了gunicorn,但实际上,日志显示出于某种原因,heroku卸载了我的“陈旧”版本。

Heroku + gunicorn not working (bash: gunicorn: command not found )