pythondjangodjango-shop

how to use the module categories?


please help solve the problem.

I installed django-shop and django-shop-categories. then followed the directions provided. added to 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')),
    ......
    .....    
)

Create a tables:

python manage.py syncdb

as a result when you try to run the site team

python manage.py runserver

I get the following error of the Report:

  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

Solution

  • django.conf.defaults was removed on django 1.6. It is possible that there are dependencies in django-shop or django-shop-categories to this depracated module. It seems that they are in django-shop-categories.

    Here is fix for you in Git of django-shop-categories package.

    In 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