我是 Django 的新手。它抛出这样的错误:
File "/home1/monkevco/django/django_src/django/template/defaulttags.py", line 418, in render
raise e
NoReverseMatch: Reverse for '' with arguments '()' and keyword arguments '{}' not found.
我的 urls.py 看起来像:
urlpatterns = patterns('',
url(r'^accounts/register/$',
register,
{ 'backend': 'lbregistration.backends.simple.SimpleBackend' },
name='registration_register'),
url(r'^user/(?P<user_id>\d+)/$', profile, name='user_profile'),
url(r'^accounts/avatar/', include('simpleavatar.urls')),
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^attachments/', include('attachments.urls')),
url(r'^captcha/', include('captcha.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('lbforum.urls')),
)
更新:Django 版本 1.5
输入网址:http://monkev.com
错误位置:
<div id="brd-head" class="gen-content">
<p id="brd-access"><a href="#brd-main">Skip to forum content</a></p>
<p id="brd-title"><a href="{% url lbforum_index %}">{{ LBFORUM_TITLE }}</a></p>
<p id="brd-desc">{{ LBFORUM_SUB_TITLE }}</p>
</div>
请帮我弄清楚。非常感谢你。
更新:
在调试页面中:
Request URL: http://monkev.com/
Django Version: 1.5
Exception Type: NoReverseMatch
Exception Value:
Reverse for '' with arguments '()' and keyword arguments '{}' not found.
...
...
'/home1/monkevco/python/lib/python2.7/site-packages/Django-1.4.1-py2.7.egg',
我在 python 路径中调用了 Django 1.4.1,但是为什么运行的版本是 Django 1.5?如何强制它到 1.4.1?