私はPython 3.6.0、Django 1.10.6、およびOscarバージョン1.4.0の最終版で作業しています。Python 3でdjango-oscarを動作させることはできますか?
特定の解決策(たとえば、昔の自動生成wsgi.pyを「まだ」だったものを更新する)や、import django
とdjango.setup()
をほぼ最上部の近くに追加するなど、同様のエラーメッセージが報告され報告されましたSECRET_KEY
およびINSTALLED_APPS
、上部近くに移動)。私はGithubのエラーメッセージに近い一致を見つけました.Gitubの目的のために、標準のユーザまたは認証モジュールをプロジェクトから削除することが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
、親切や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
オスカーには、どうすればいいはずなのですか?
「django.contrib.sites」と「django.contrib.contenttypes」というモデルではなく、インストールされているアプリにアプリを追加する必要があります。 –
ありがとうございます。私は個々のモデルを参照する行を削除しました。エラーメッセージは同じです。 – JonathanHayward
私の質問は下落しているのが分かります。私はどのような変更が私の質問をより良くし、より下降価値のあるものにするかについてアドバイスをしてもらえますか? – JonathanHayward