django注册redux错误

时间:2017-11-01 22:45:43

标签: python django django-registration

我在我的django项目中使用django registration redux,当你访问时,问题出现在地图网址上:

  

http://127.0.0.1:8000/accounts/register/

它将我重定向到:

  

http://127.0.0.1:8000/accounts/profile/

错误消息:

Using the URLconf defined in trydjango18.urls, Django tried these URL 
patterns, in this order:
   ^$ [name='home']
   ^contact$ [name='contact']
   ^about$ [name='about']
   ^admin/
   ^accounts/ 
   ^activate/complete/$[name='registration_activation_complete']
   ^accounts/ 
   ^activate/resend/$[name='registration_resend_activation']
   ^accounts/ 
   ^activate/(P<activation_key>\w+)/$[name='registration_activate']
   ^accounts/ ^register/complete/$ [name='registration_complete']
   ^accounts/ ^register/closed/$ [name='registration_disallowed']
   ^accounts/ ^register/$ [name='registration_register']
   ^accounts/ ^login/$ [name='auth_login']
   ^accounts/ ^logout/$ [name='auth_logout']
   ^accounts/ ^password/change/$ [name='auth_password_change']
   ^accounts/ 
   ^password/change/done/$[name='auth_password_change_done']
   ^accounts/ ^password/reset/$ [name='auth_password_reset']
   ^accounts/ 
   ^password/reset/complete/$[name='auth_password_reset_complete']
   ^accounts/ ^password/reset/done/$ [name='auth_password_reset_done']
   ^accounts/ ^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?
   P<token>.+)/$ [name='auth_password_reset_confirm']
   ^static\/(?P<path>.*)$
   ^media\/(?P<path>.*)$
The current URL, accounts/profile/, didn't match any of these. 
You're seeing this error because you have DEBUG = True in your 
Django settings file. Change that to False, and Django will display 
a standard 404 page.

这是我的settings.py

代码
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

'django.contrib.sites',
'registration', #should be immediately above 'django.contrib.auth'
'django.contrib.auth',

'crispy_forms',

'newsletter',)

ACCOUNT_ACTIVATION_DAYS = 7 REGISTRATION_AUTO_LOGIN = True 这是我的urls.py代码:

urlpatterns = [
url(r'^$', 'newsletter.views.home', name='home'),
url(r'^contact$', 'newsletter.views.contact', name='contact'),
url(r'^about$','trydjango18.views.about',name='about'),
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('registration.backends.default.urls')),]

2 个答案:

答案 0 :(得分:0)

您可以在U中设置LOGIN_REDIRECT_URL

答案 1 :(得分:0)

我遇到了同样的问题,看起来对我有什么帮助: 我从管理面板注销,这解决了我的问题。