【发布时间】:2014-11-24 21:03:16
【问题描述】:
到目前为止,我已将 django 应用程序从 1.4.1 更新到 1.6.5,它可以在本地正常工作。 我现在正在尝试将其部署到 heroku,因此我正在尝试运行 wsgi.py 文件,但是每当我在 Procfile 中使用以下内容运行它时:
web: gunicorn myapp.wsgi:application
它启动并告诉我它在哪里监听,但如果我尝试访问给定的地址,我会收到以下错误:
23:51:27 web.1 | File "~/site-packages/django/contrib/admin/helpers.py", line 8, in <module>
23:51:27 web.1 | from django.contrib.contenttypes.models import ContentType
23:51:27 web.1 | ImproperlyConfigured: Error importing module django.contrib.auth.middleware:"cannot import name ContentType"
我尝试在 Procfile 中使用以下内容:
web: python manage.py run_gunicorn
它运行了,但是这个命令已经被弃用了。
【问题讨论】:
-
您是否更新了您的 requirements.txt 文件以声明它需要
django==1.6.5?否则它可能会用你过去的版本重新旋转测功机 -
只是'web:gunicorn myapp.wsgi'
-
是的,我已经更新了我的 requirements.txt 文件。我尝试只使用 'web: gunicorn myapp.wsgi' 仍然是同样的错误
标签: python django heroku deployment