【问题标题】:django-registration URL cannot be resolveddjango-registration URL 无法解析
【发布时间】:2013-07-06 12:35:36
【问题描述】:

我正在使用 django 1.5.1 和 django-registration 1.0。

我收到一个错误:

NoReverseMatch at /accounts/password/reset/
Reverse for 'django.contrib.auth.views.password_reset_done' with arguments '()' and     keyword arguments '{}' not found.
Request Method: GET
Request URL:    http://localhost:8000/accounts/password/reset/
Django Version: 1.5.1
Exception Type: NoReverseMatch
Exception Value:    
Reverse for 'django.contrib.auth.views.password_reset_done' with arguments '()' and keyword arguments '{}' not found.

在我的 urls.py 中有:

url(r'^accounts/', include('registration.backends.default.urls', namespace='re    gistration', app_name='registration')),

以前有人遇到过这个问题吗?

【问题讨论】:

  • 你加入了django.contrib.auth.urls 吗? (see it here) registration.backends.default.urls 不提供登录/注销/密码管理。
  • 是的。将其包含在新行中 url(r'^account/', include('django.contrib.auth.urls'),

标签: django django-registration


【解决方案1】:

只需包括以下几行,它应该可以工作: url(r'accounts/', include('django.contrib.auth.urls')),

我的 urls.py: ``` from django.conf.urls 导入模式,包含,url

从 django.contrib 导入管理员 admin.autodiscover()

urlpatterns = 模式('', # 例子: # url(r'^$', 'django_registration_demo.views.home', name='home'), # url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),
url(r'accounts/', include('django.contrib.auth.urls')),
url(r'^accounts/', include('registration.backends.default.urls'))

) ```

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-03
    • 2017-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多