如果其他人尝试这个,这是我的问题(这是相当愚蠢的)。
我已经定义了我的urls.py 作为:
urlpatterns = [
#override the django_registration activation view
url(r'^accounts/activate/(?P<activation_key>[-:\w]+)/$',
views.MyActivationView.as_view(),
name='django_registration_activate'),
#override form
url(r'^accounts/register/$',
views.NoUsernameRegistrationView.as_view(),
name='django_registration_register'),
#But use the other views
url(r'^accounts/', include('django_registration.backends.activation.urls')),
url(r'^accounts/', include('django.contrib.auth.urls')),
]
激活失败,因为它试图调用
/accounts/activation/complete/
使用“complete”作为
activation_key
urlpatterns = [
url(r'^accounts/activate/complete/$',
TemplateView.as_view(
template_name='django_registration/activation_complete.html'
),
name='django_registration_activation_complete'),
#override the django_registration activation view
url(r'^accounts/activate/(?P<activation_key>[-:\w]+)/$',
views.MyActivationView.as_view(),
name='django_registration_activate'),
#override form
url(r'^accounts/register/$',
views.NoUsernameRegistrationView.as_view(),
name='django_registration_register'),
#But use the other views
url(r'^accounts/', include('django_registration.backends.activation.urls')),
url(r'^accounts/', include('django.contrib.auth.urls')),
]