请帮助解决问题。
我安装了django-shop和django-shop-categories。然后按照提供的指示。 添加到settings.py:
SHOP_PRODUCT_MODEL = shop_categories.models.defaults.product.default.CategoryProduct
INSTALLED_APPS = (
........
.....
.....
'polymorphic', # We need polymorphic installed for the shop
'shop', # The django SHOP application
'shop.addressmodel',
'myshop', # the project we just created
'shop_categories',
'treeadmin',
)
added to urls.py:
urlpatterns += patterns('',
url(r'^catalog/', include('shop_categories.urls')),
......
.....
)
创建表格:
python manage.py syncdb
因此,当您尝试运行网站团队时
python manage.py runserver
我收到以下报告错误:
File "/home/kalinin/.virtualenvs/searche_project/searche/searche/urls.py", line 15, in <module>
url(r'^catalog/', include('shop_categories.urls')),
File "/home/kalinin/.virtualenvs/searche_project/searche_env/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 26, in include
urlconf_module = import_module(urlconf_module)
File "/home/kalinin/.virtualenvs/searche_project/searche_env/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/kalinin/.virtualenvs/searche_project/searche/shop_categories/urls.py", line 1, in <module>
from django.conf.urls.defaults import patterns, url
ImportError: No module named defaults
答案 0 :(得分:0)
这是django-shop-categories包的Git中的修复程序。
在shop_categories / urls.py
try:
# django 1.6+
from django.conf.urls import patterns, url
except ImportError:
# django <1.6
from django.conf.urls.defaults import patterns, url