0

请帮助解决问题。

我安装了 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
4

1 回答 1

0

django.conf.defaults在 django 1.6 上被删除。django-shop 或 django-shop-categories 中可能存在对这个已弃用模块的依赖项。似乎它们在 django-shop-categories 中。

这是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
于 2014-12-09T13:58:11.353 回答