gpt4 book ai didi

python - 使用 Heroku 部署时如何解决 "' django_content_type' does not exit” 错误?

转载 作者:行者123 更新时间:2023-12-01 04:01:51 24 4
gpt4 key购买 nike

我正在尝试使用 Heroku 部署我的第一个真正的网站。我过去曾成功部署过一个 super 简单的网站,但这次我似乎陷入了困境。我能够在本地正常运行该网站。

当我在 Heroku 上单击“免费部署”时,它成功创建应用程序、配置环境并构建应用程序。该错误来自运行脚本和比例测功机部分,显示“部署后退出代码不是 0”

我正在使用 Django 1.9.4 和 cookiecutter-django开始我的项目。我还添加了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.

最佳答案

如果您尚未使用 Wagtail 1.4.3,请尝试升级到它 - 最新版本修复了与从头开始启动项目数据库相关的几个问题。

关于python - 使用 Heroku 部署时如何解决 "' django_content_type' does not exit” 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36345451/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com