我正在使用Python 3.6.0,Django 1.10.6和Oscar 1.4.0版final。我可以让Django-oscar在Python 3下工作吗?
我见过的讨论看起来相似的错误信息和报告解决方案的某些解决(如更新什么是“还是”旧的时间自动生成wsgi.py),或之前添加import django
和django.setup()
几乎接近顶部(即SECRET_KEY
和INSTALLED_APPS
,向上移动靠近顶部)。我发现Github上的错误消息更接近匹配,Raven的用户已经明确地从他们的项目中删除了标准用户或身份验证模块。然而,我还没有找到某个地方有人报告错误,除了全面清除从基于Django的不相关项目中删除标准Django应用程序之外,还有一个解决方案。
特定的错误消息和跟踪不会向我大喊什么行是在怀疑它是由INSTALLED_APPS包含'django.contrib.contenttypes'触发的问题。我收到的时候我尝试运行它的轨迹是:
(store-env) ~/store $ python manage.py migrate Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/base.py", line 342, in execute self.check() File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/base.py", line 374, in check include_deployment_checks=include_deployment_checks, File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks issues.extend(super(Command, self)._run_checks(**kwargs)) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/management/base.py", line 361, in _run_checks return checks.run_checks(**kwargs) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config return check_resolver(resolver) File "/Users/christos/store-env/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver for pattern in resolver.url_patterns: File "/Users/christos/store-env/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/christos/store-env/lib/python3.6/site-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/christos/store-env/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/Users/christos/store-env/lib/python3.6/site-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/Users/christos/store-env/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/christos/store/store/urls.py", line 18, in <module> from oscar.app import application File "/Users/christos/store-env/lib/python3.6/site-packages/oscar/app.py", line 5, in <module> from django.contrib.auth import views as auth_views File "/Users/christos/store-env/lib/python3.6/site-packages/django/contrib/auth/views.py", line 11, in <module> from django.contrib.auth.forms import ( File "/Users/christos/store-env/lib/python3.6/site-packages/django/contrib/auth/forms.py", line 12, in <module> from django.contrib.auth.models import User File "/Users/christos/store-env/lib/python3.6/site-packages/django/contrib/auth/models.py", line 6, in <module> from django.contrib.contenttypes.models import ContentType File "/Users/christos/store-env/lib/python3.6/site-packages/django/contrib/contenttypes/models.py", line 138, in <module> class ContentType(models.Model): File "/Users/christos/store-env/lib/python3.6/site-packages/django/db/models/base.py", line 113, in __new__ "INSTALLED_APPS." % (module, name) RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. (store-env) ~/store $
我目前settings.py
,有益或帮倒忙从什么据称为他人工作的如此修改,最多也就是一个不变import os
:
from oscar.defaults import *
from django.conf import settings
settings.configure()
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '[DELETED]'
from oscar import get_core_apps
INSTALLED_APPS = [
#'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'django.contrib.sites.models.Site',
'django.contrib.contenttypes.models.ContentType',
'compressor',
'widget_tweaks'
] + get_core_apps()
import django
django.setup()
"""
Django settings for store project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
奥斯卡有什么可以/应该做些什么,它拥有应该得到的所有应用程序?
您应该将应用程序添加到未安装的应用程序,即“django.contrib.sites'和'django.contrib.contenttypes'。 –
谢谢;我删除了涉及单个模型的行。错误消息是相同的。 – JonathanHayward
我看到我的问题已被降低。对于哪些变化会使我的问题变得更好,并且降低投资回报率,我能否提供任何建议? – JonathanHayward