我正在尝试使用Heroku部署我的第一个真实网站。我曾经用一个超级简单的网站成功部署了一次,但这次我似乎陷入困境。我能够在本地运行该网站。
当我在Heroku上单击免费部署时,它会成功创建应用程序,配置环境和构建应用程序。该错误来自Run脚本&规模dynos部分说'postdeploy退出代码不是0'
我正在使用带有cookiecutter-django的Django 1.9.4来启动我的项目。我还在项目中添加了wagtail,并用它制作了一些相当简单的页面。如果您需要查看我的其他任何文件,请告诉我们。我对此感到茫然。
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/contenttypes/models.py", line 67, in get_for_model
ct = self.get(app_label=opts.app_label, model=opts.model_name)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py", line 381, in get
num = len(clone)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py", line 240, in __len__
self._fetch_all()
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
^
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 398, in execute
self.check()
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/app/.heroku/python/lib/python3.5/site-packages/django/core/checks/model_checks.py", line 28, in check_all_models
errors.extend(model.check(**kwargs))
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailcore/models.py", line 572, in check
if not issubclass(edit_handler.get_form_class(cls), WagtailAdminPageForm):
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 294, in get_form_class
formsets=cls.required_formsets(),
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 240, in required_formsets
formsets.update(handler_class.required_formsets())
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 240, in required_formsets
formsets.update(handler_class.required_formsets())
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 603, in required_formsets
'widgets': child_edit_handler_class.widget_overrides(),
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 216, in widget_overrides
widgets.update(handler_class.widget_overrides())
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 216, in widget_overrides
widgets.update(handler_class.widget_overrides())
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 516, in widget_overrides
content_type=cls.target_content_type(), can_choose_root=cls.can_choose_root)}
File "/app/.heroku/python/lib/python3.5/site-packages/wagtail/wagtailadmin/edit_handlers.py", line 543, in target_content_type
cls._target_content_type = [ContentType.objects.get_for_model(target_model)]
File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/contenttypes/models.py", line 80, in get_for_model
"Error creating new content types. Please make sure contenttypes "
RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.
答案 0 :(得分:1)
您可能需要使用以下命令运行迁移命令:
heroku run python manage.py migrate
答案 1 :(得分:1)
如果您还没有使用Wagtail 1.4.3,请尝试升级 - 最新版本修复了一些与从头开始创建项目数据库相关的问题。