简体   繁体   English

帐户激活django_registration_email错误

[英]Error on account activation django_registration_email

I've implemented authentication on my application using django_registration and django_registration email. 我已经使用django_registration和django_registration电子邮件在应用程序上实现了身份验证。 Here is my code: 这是我的代码:

settings.py settings.py

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',

#custom apps
'order',
'fiesta',

#3rd party apps
'south',
'jquery',
'djangoformsetjs',

# DEVELOPER TOOLS
'debug_toolbar',
#authentication apps
'registration',
'registration_email',

)

#DJANGO REGISTRATION SETTINGS

ACCOUNT_ACTIVATION_DAYS = 7 # one week activation window

AUTHENTICATION_BACKENDS = (
'registration_email.auth.EmailBackend',
)

LOGIN_REDIRECT_URL = '/'

urls.py urls.py

urlpatterns = patterns('',
url(r'^$', lambda x:HttpResponseRedirect("/fiesta/workspace/"), name="home"),
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('registration_email.backends.default.urls')),
url(r'^fiesta/', include('fiesta.urls')),

)

The registration email is sent okay but when i click on the account activation link, here is the error i get: 注册电子邮件发送正常,但是当我单击帐户激活链接时,这是我得到的错误:

Traceback:
File "/home/blaqx/.virtualenv/django5/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115.response = callback(request, *callback_args, **callback_kwargs)
File "/home/blaqx/.virtualenv/django5/lib/python2.7/site-packages/django/views/generic/base.py" in view
68.return self.dispatch(request, *args, **kwargs)
File "/home/blaqx/.virtualenv/django5/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
86.return handler(request, *args, **kwargs)
File "/home/blaqx/.virtualenv/django5/lib/python2.7/site-packages/registration/views.py" in get
126.success_url = self.get_success_url(request, activated_user)

Exception Type: TypeError at /accounts/activate/bf93e2619ad0b7419b34dc0284e172fae8ecafef/
Exception Value: 'str' object is not callable

In the error, I can see that during account activation, a reference is being made to django-registration instead of django-registration-email. 在错误中,我可以看到在帐户激活期间,正在引用django-registration而不是django-registration-email。 I however don't know if this is the cause of the error and how to solve it. 但是,我不知道这是否是错误的原因以及如何解决。 Any help will be greatly appreciated. 任何帮助将不胜感激。

First you are using two packages for same purpose(ie; sending the email activation), Here the packeges, 首先,您将两个软件包用于相同目的(即发送电子邮件激活),在这里,这些软件包

  1. django-registration-email django注册电子邮件
  2. django-registration django注册

Select the one package from above. 从上方选择一个包。 I choose django-registration, Here the doc https://django-registration.readthedocs.org . 我选择django-registration,这里是文档https://django-registration.readthedocs.org

And follow the code instructions, 并遵循代码说明,

settings.py settings.py

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',

#custom apps
'order',
'fiesta',

#3rd party apps
'south',
'jquery',
'djangoformsetjs',

# DEVELOPER TOOLS
'debug_toolbar',
#authentication apps
'registration',
#'registration_email',
)

#DJANGO REGISTRATION SETTINGS

ACCOUNT_ACTIVATION_DAYS = 7 # one week activation window

#AUTHENTICATION_BACKENDS = (
#'registration_email.auth.EmailBackend',
#)

LOGIN_REDIRECT_URL = '/'

urls.py urls.py

urlpatterns = patterns('',
url(r'^$', lambda x:HttpResponseRedirect("/fiesta/workspace/"), name="home"),
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^fiesta/', include('fiesta.urls')),
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM