我在我的夹层项目中使用 django_select2。
根据文档,我遵循流程。
#步骤1 : 点安装 django-select2 #第2步 : url(r'^select2/', 包括('django_select2.urls')),
但是当我重新加载我的网站时出现错误
/admin/cms_shop/deliverymethod/200/ 处的 TemplateSyntaxError 渲染时捕获 NameError:未定义名称“模式” 请求方法:GET 请求网址:https://example.net/admin/cms_shop/deliverymethod/200/ Django 版本:1.3.1 异常类型:TemplateSyntaxError 异常值: 渲染时捕获 NameError:未定义名称“模式” 异常位置:/home/django/cmsenv/lib/python2.6/site-packages/django_select2/urls.py 在第 5 行 Python 可执行文件:/home/django/cmsenv/bin/python Python版本:2.6.5 蟒蛇路径: ['/home/django/core/python/cmsintegration', '/home/django/cmsenv/lib/python2.6/site-packages/distribute-0.6.14-py2.6.egg', '/home/django/cmsenv/lib/python2.6/site-packages/pip-0.8.3-py2.6.egg', '/home/django/cmsenv/lib/python2.6/site-packages/paython-0.0.1-py2.6.egg', '/home/django/cmsenv/lib/python2.6/site-packages/django_shop-0.0.11.dev0-py2.6.egg', '/home/django/cmsenv/lib/python2.6/site-packages/django_recaptcha-0.0.6-py2.6.egg', '/home/django/cmsenv/lib/python2.6', '/home/django/cmsenv/lib/python2.6/plat-linux2', '/home/django/cmsenv/lib/python2.6/lib-tk', '/home/django/cmsenv/lib/python2.6/lib-old', '/home/django/cmsenv/lib/python2.6/lib-dynload', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/home/django/cmsenv/lib/python2.6/site-packages', '/home/django/cmsenv/lib/python2.6/site-packages/PIL']
请帮助我做错了什么。我的 urls.py 代码是
从 django.conf.urls.defaults 导入 * 从 django.contrib 导入管理员 admin.autodiscover() urlpatterns = 模式(“”, url(r'^admin/cms_shop/productimport/delete_selected/([\w]+)/$', delete_selected_import_view, name="cms_shop_delete_selected_import"), url("^admin/", 包括(admin.site.urls)), url(r'^select2/', 包括('django_select2.urls')), )
在设置.py
INSTALLED_APPS = ( "django.contrib.admin", “django.contrib.auth”, "django.contrib.contenttypes", “django.contrib.redirects”, “django.contrib.sessions”, “django.contrib.sites”, "django.contrib.sitemaps", “夹层.conf”, “夹层.核心”, "夹层.blog", “夹层.pages”, "mezzanine.generic", “用户应用程序”, "django_select2", )