简体   繁体   English

部署django应用。 在heroku上(gunicorn,wsgi问题)

[英]Deploying django app. on heroku (gunicorn, wsgi issue)

I have updated my django application from 1.4.1 to 1.6.5 so far it works properly locally. 我已经将django应用程序从1.4.1更新到1.6.5,到目前为止,它在本地可以正常运行。 I am now trying to deploy it to heroku, so I am trying to run the wsgi.py file, but whenever I run it with the following in the Procfile: 我现在正尝试将其部署到heroku,因此尝试运行wsgi.py文件,但是无论何时只要在Procfile中使用以下命令运行它:

web: gunicorn myapp.wsgi:application

It starts and tells me where its listening, but if I try to access the address given, I get the following error: 它启动并告诉我它在哪里监听,但是如果我尝试访问给定的地址,则会收到以下错误:

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"

I tried to use the following in the Procfile: 我试图在Procfile中使用以下内容:

web: python manage.py run_gunicorn

It ran, BUT this command has been deprecated. 它已运行,但此命令已被弃用。

It related with 'ContentTypes' model . 它与'ContentTypes'模型有关。 Can you inspect the database .. it having the table called 'contenttype' . 您能检查数据库..它的表名为'contenttype' If it's there then delete it. 如果存在,则将其删除。 Before doing the migration again .. make sure 'django.contrib.contenttypes' listed in INSTALLED_APPS 在再次进行迁移之前..确保在INSTALLED_APPS列出了'django.contrib.contenttypes'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM