NotImplementedError в django-регистрации при регистрации пользователя

У меня есть приложение Django и пытаюсь использоватьdjango-registration приложение в нем. И ниже мои настройки и коды

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',
    'south',
    'registration',
    'user_profile',
 )

AUTH_PROFILE_MODULE = "user_profile.UserProfile"
AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
)

проектurls.py файл

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^accounts/', include('user_profile.urls')),
    url(r'^accounts/', include('registration.backends.default.urls')),
 )

user_profile urls.py файл

from registration.views import RegistrationView

urlpatterns = patterns('',
    url(r'^register/

user_profile.backends.py файл

from .forms import RegistrationForm
from user_profile.models import UserProfile
from registration.views import RegistrationView

class RegistrationBackend(RegistrationView):
    def get_form_class(self, request)
        return RegistrationForm

    def register(self, request, **kwargs):
        kwargs["username"] = kwargs["email"]
        user = super(RegistrationBackend, self).register(request, **kwargs)
        UserProfile.objects.create(user=user)
        return user

Так из приведенного выше кода, когда пользователь нажимает URLlocalhost:8000/accounts/register Форма регистрации будет отображаться, и после ввода всех полей (username,email, password, password) и нажал нарегистр Кнопка Я получаю нижеNotImplementedError

NotImplementedError at /accounts/register/
No exception supplied
Request Method: POST
Request URL:    http://localhost:8000/accounts/register/
Django Version: 1.5.1
Exception Type: NotImplementedError

Проследить

Traceback:
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in dispatch
  79.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in post
  35.             return self.form_valid(request, form)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in form_valid
  82.         new_user = self.register(request, **form.cleaned_data)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in register
  109.         raise NotImplementedError

Exception Type: NotImplementedError at /accounts/register/
Exception Value: 

может кто знает как этого избежатьNotImplementedErrorна самом деле в соответствии с первоначальным взглядом наpython2.7/site-packages/registration/views.py ,register метод

def register(self, request, **cleaned_data):
    """
    Implement user-registration logic here. Access to both the
    request and the full cleaned_data of the registration form is
    available here.

    """
    raise NotImplementedError

Но я предоставляю внутренний класс для использования для регистрации пользователя в моем URL как {'backend': 'user_profile.backends.RegistrationBackend'}, но все же он не переопределяет и не отображает исходную функциональную ошибку.

Так что же я делаю не так в приведенном выше сценарии и как исправить и заставить пользователя сохранить?

редактировать

После изменения кода, как указаноPaco

при попытке зарегистрировать пользователя я получил ошибку ниже

error at /accounts/register/
[Errno 111] Connection refused
Request Method: POST
Request URL:    http://localhost:8000/accounts/register/
Django Version: 1.5.1
Exception Type: error
Exception Value:    
[Errno 111] Connection refused

Проследить

Traceback:
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in dispatch
  79.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in post
  35.             return self.form_valid(request, form)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in form_valid
  82.         new_user = self.register(request, **form.cleaned_data)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/backends/default/views.py" in register
  80.                                                                     password, site)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  223.                 return func(*args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/models.py" in create_inactive_user
  91.             registration_profile.send_activation_email(site)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/models.py" in send_activation_email
  270.         self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/contrib/auth/models.py" in email_user
  422.         send_mail(subject, message, from_email, [self.email])
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/__init__.py" in send_mail
  62.                         connection=connection).send()
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/message.py" in send
  255.         return self.get_connection(fail_silently).send_messages([self])
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in send_messages
  88.             new_conn_created = self.open()
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in open
  49.                                            local_hostname=DNS_NAME.get_fqdn())
File "/usr/lib/python2.7/smtplib.py" in __init__
  249.             (code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py" in connect
  309.         self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py" in _get_socket
  284.         return socket.create_connection((port, host), timeout)
File "/usr/lib/python2.7/socket.py" in create_connection
  571.         raise err

Exception Type: error at /accounts/register/
Exception Value: [Errno 111] Connection refused
, RegistrationView.as_view(), {'backend': 'user_profile.backends.RegistrationBackend'}, name='registration_register'), )

user_profile.backends.py файл

from .forms import RegistrationForm
from user_profile.models import UserProfile
from registration.views import RegistrationView

class RegistrationBackend(RegistrationView):
    def get_form_class(self, request)
        return RegistrationForm

    def register(self, request, **kwargs):
        kwargs["username"] = kwargs["email"]
        user = super(RegistrationBackend, self).register(request, **kwargs)
        UserProfile.objects.create(user=user)
        return user

Так из приведенного выше кода, когда пользователь нажимает URLlocalhost:8000/accounts/register Форма регистрации будет отображаться, и после ввода всех полей (username,email, password, password) и нажал нарегистр Кнопка Я получаю нижеNotImplementedError

NotImplementedError at /accounts/register/
No exception supplied
Request Method: POST
Request URL:    http://localhost:8000/accounts/register/
Django Version: 1.5.1
Exception Type: NotImplementedError

Проследить

Traceback:
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in dispatch
  79.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in post
  35.             return self.form_valid(request, form)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in form_valid
  82.         new_user = self.register(request, **form.cleaned_data)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in register
  109.         raise NotImplementedError

Exception Type: NotImplementedError at /accounts/register/
Exception Value: 

может кто знает как этого избежатьNotImplementedErrorна самом деле в соответствии с первоначальным взглядом наpython2.7/site-packages/registration/views.py ,register метод

def register(self, request, **cleaned_data):
    """
    Implement user-registration logic here. Access to both the
    request and the full cleaned_data of the registration form is
    available here.

    """
    raise NotImplementedError

Но я предоставляю внутренний класс для использования для регистрации пользователя в моем URL как {'backend': 'user_profile.backends.RegistrationBackend'}, но все же он не переопределяет и не отображает исходную функциональную ошибку.

Так что же я делаю не так в приведенном выше сценарии и как исправить и заставить пользователя сохранить?

редактировать

После изменения кода, как указаноPaco

при попытке зарегистрировать пользователя я получил ошибку ниже

error at /accounts/register/
[Errno 111] Connection refused
Request Method: POST
Request URL:    http://localhost:8000/accounts/register/
Django Version: 1.5.1
Exception Type: error
Exception Value:    
[Errno 111] Connection refused

Проследить

Traceback:
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in dispatch
  79.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  86.         return handler(request, *args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in post
  35.             return self.form_valid(request, form)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/views.py" in form_valid
  82.         new_user = self.register(request, **form.cleaned_data)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/backends/default/views.py" in register
  80.                                                                     password, site)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  223.                 return func(*args, **kwargs)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/models.py" in create_inactive_user
  91.             registration_profile.send_activation_email(site)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/registration/models.py" in send_activation_email
  270.         self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/contrib/auth/models.py" in email_user
  422.         send_mail(subject, message, from_email, [self.email])
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/__init__.py" in send_mail
  62.                         connection=connection).send()
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/message.py" in send
  255.         return self.get_connection(fail_silently).send_messages([self])
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in send_messages
  88.             new_conn_created = self.open()
File "/home/user/proj/combined/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in open
  49.                                            local_hostname=DNS_NAME.get_fqdn())
File "/usr/lib/python2.7/smtplib.py" in __init__
  249.             (code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py" in connect
  309.         self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py" in _get_socket
  284.         return socket.create_connection((port, host), timeout)
File "/usr/lib/python2.7/socket.py" in create_connection
  571.         raise err

Exception Type: error at /accounts/register/
Exception Value: [Errno 111] Connection refused

Ответы на вопрос(3)

Ваш ответ на вопрос