gpt4 book ai didi

django_select2 在渲染 : name 'patterns' is not defined 时捕获到 NameError

转载 作者:行者123 更新时间:2023-12-03 18:16:00 24 4
gpt4 key购买 nike

我在夹层项目中使用 django_select2。
根据文档,我遵循流程。

#第1步 :
pip 安装 django-select2
#第2步 :
url(r'^select2/', include('django_select2.urls')),

但是当我重新加载我的网站时出现错误

TemplateSyntaxError at/admin/cms_shop/deliverymethod/200/

渲染时捕获 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 in ,第 5 行
Python 可执行文件:/home/django/cmsenv/bin/python
Python 版本:2.6.5
python 路径:

['/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/", include(admin.site.urls)),
url(r'^select2/', include('django_select2.urls')),
)

在设置.py

安装_应用程序 = (
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.redirects",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.sitemaps",
"mezzanine.conf",
"mezzanine.core",
"mezzanine.blog",
"mezzanine.pages",
"mezzanine.generic",
“用户应用程序”,
"django_select2",
)

最佳答案

仅供引用,您有 Django 1.3,应该考虑升级到 1.5。

你有没有尝试过

from django.conf.urls import patterns

关于django_select2 在渲染 : name 'patterns' is not defined 时捕获到 NameError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19701076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com