0

私は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

入力 URL: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 にする方法は?

4

1 に答える 1

1

Django トランクを実行していますか? 代わりに、最新リリースの Django 1.4.1 を実行することをお勧めします。

タグの{% url %}構文は Django 1.5 で変更されています。つまり、インストールされたアプリのテンプレートを含め、それを使用するすべてのテンプレートを更新する必要があります。

于 2012-08-20T10:41:50.507 に答える