2017-03-08 54 views
-1

我正在使用Python 3.6.0,Django 1.10.6和Oscar 1.4.0版final。我可以讓Django-oscar在Python 3下工作嗎?

我見過的討論看起來相似的錯誤信息和報告解決方案的某些解決(如更新什麼是「還是」舊的時間自動生成wsg​​i.py),或之前添加import djangodjango.setup()幾乎接近頂部(即SECRET_KEYINSTALLED_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

奧斯卡有什麼可以/應該做些什麼,它擁有應該得到的所有應用程序?

+1

您應該將應用程序添加到未安裝的應用程序,即「django.contrib.sites'和'django.contrib.contenttypes'。 –

+0

謝謝;我刪除了涉及單個模型的行。錯誤消息是相同的。 – JonathanHayward

+0

我看到我的問題已被降低。對於哪些變化會使我的問題變得更好,並且降低投資回報率,我能否提供任何建議? – JonathanHayward

回答

0
'django.contrib.sites.models.Site', 
'django.contrib.contenttypes.models.ContentType' 

這不應該在已安裝的應用程序部分。這些是模型,已安裝的應用程序部分主要針對應用程序。

相關問題