2017-03-08 9 views
-1

파이썬 3.6.0, 장고 1.10.6 및 오스카 버전 1.4.0 최종본으로 작업 중입니다.Python 3에서 django-oscar를 사용할 수 있습니까?

특정 솔루션 (예 : "기존"자동 업데이트 된 wsgi.py)을 업데이트하거나 상단에 거의 import djangodjango.setup()을 추가하여 유사한 오류 메시지가 논의되고보고 된 것을 보았습니다 SECRET_KEYINSTALLED_APPS, 맨 위 가까이 위로 이동). Raven 사람들이 프로젝트에서 표준 사용자 또는 인증 모듈을 삭제할 수있는 권한을 부여받은 Github의 오류 메시지와 더 가까운 일치를 발견했습니다. 그러나 누군가가 오류를보고하는 장소를 찾지 못했고 관련이없는 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, 유용하게 또는 unhelpfully 손길이 닿지 않은 import os까지이며, 보도 SO에 다른 사람을 위해 일한 것과 수정 :

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

나는 나의 질문이 downvoted다는 것을 나는 본다. 나는 변화가 내 질문을 더 좋게하고 덜 하향 - 가치있는 것으로 만드는 것에 관해 어떤 조언을 할 수 있을까? – JonathanHayward

답변

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

이것은 설치된 응용 프로그램 섹션에 있어서는 안됩니다. 이들은 모델이며 설치된 앱 섹션은 주로 앱용입니다.