0

按照 django-oscar 文档分叉应用程序后,出现此错误:

ImportError:没有名为“apps\promotions”的模块

不知道我做错了什么

我做了什么:

python manage.py oscar_fork_app 促销应用

创建包应用程序\促销

创建 admin.py

创建应用配置

创建模型.py

创建迁移文件夹

最后一步是将“apps\promotions”添加到 INSTALLED_APPS(替换等效的 Oscar 应用程序)。这可以使用 Oscar 的 get_core_apps 函数来实现 - 例如:

# settings.py
...
INSTALLED_APPS = [
'django.contrib.auth',
...
]
from oscar import get_core_apps
INSTALLED_APPS = INSTALLED_APPS + get_core_apps(
['apps\promotions'])

INSTALLED_APPS = [

'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'compressor',
"django.contrib.admin",
'widget_tweaks',
"paypal",
] + get_core_apps(['apps.promotions'])
4

1 回答 1

0

你应该使用

INSTALLED_APPS = INSTALLED_APPS + get_core_apps(['apps.promotions'])

https://django-oscar.readthedocs.org/en/latest/topics/customisation.html#replace-oscar-s-app-with-your-own-in-installed-apps

于 2015-09-22T19:29:42.473 回答