[Answered ]-Django-registration 1.0 Registration not working

1👍

The problem is you are using Python 3; and django-registration is not yet compatible with it. You need to use Python 2.7.x

1👍

I had the same problem with my django-registration + Python 3.3 and solved the issue by changing few lines in create_profile function of django-registration’s models.py.

The problem is only ‘utf-8’ encoded strings are compatible with the hashlib.sha1 hashing function.

Therefore I have rewritten the following code block

salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
username = user.username
if isinstance(username, unicode):
    username = username.encode('utf-8')
activation_key = hashlib.sha1(salt+username).hexdigest()

as this

salt = hashlib.sha1(str(random.random()).encode('utf-8')).hexdigest()[:5]
salted_username = salt + user.username
activation_key = hashlib.sha1(salted_username.encode('utf-8')).hexdigest()

Encoding the string object before passing it as an argument seems to solve the problem in my case.

0👍

I think the password must be encode in utf-8 before hash it. seems like django-registration 1.0 ha a lot of problems.

👤Midimo

0👍

As others said, the problem is that django-registration doesn’t support Python 3.

The author of the package stopped maintaining it in September 2013. Seems that django-allauth is currently the best replacement that works in both Python 2 and 3 (recommended by pydanny).

Leave a comment