一個應用程序,當我試圖定製奧斯卡,並添加應用程序稱爲促銷INSTALLED_APPS導入錯誤:在Django奧斯卡無模塊命名爲應用程序錯誤 - 而包括INSTALLED_APPS
(oscar)Macs-MacBook-Air:cyshop Mac$ python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/Mac/virtualenvs/oscar/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/Users/Mac/virtualenvs/oscar/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/Users/Mac/virtualenvs/oscar/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/Mac/virtualenvs/oscar/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/Mac/virtualenvs/oscar/lib/python2.7/site-packages/django/apps/config.py", line 112, in create
mod = import_module(mod_path)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named apps
下,我不知道如果我收到此錯誤它無法選擇我已添加促銷活動的應用程序文件夾。
settings.py看起來是這樣的:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'compressor',
'widget_tweaks'
]
from oscar import get_core_apps
INSTALLED_APPS = INSTALLED_APPS + get_core_apps(
['apps.promotions'])
我的文件結構是: | cyshop
|_init_.py
|db.sqlite3
|manage.py
|settings.py
|apps
|_init_.py
|promotions
|_init_.py
|models.py
|urls.py
|wsgi.py
請你幫助我。不知道爲什麼導入錯誤發生時,我添加屬性到get_core_apps()