I’ve been wanting to migrate away from django-registration for a while.
Yes, I know it’s been the default registration package since forever and I’ve used it happily for many years. But :
- it’s no longer actively maintained
- I want to do away with the email confirmation
- I want to allow login using either email or username
So after a bit of googling, I decided to try out django-allauth, and I’ve just finished the migration.
Here’s some notes for anyone else thinking about doing the same.
I’ve got an existing system:
Note: I’m only setting up the ‘accounts’ side of the allauth package, I’ll leave the social-accounts for later.
So here’s what I did:
- Set up django-allauth as per their documentation at http://django-allauth.readthedocs.org/
- Removed the django-registration module from the settings
- I wanted to use my own templates rather than theirs, so I added an account subdirectory into my accounts/templates and copied theirs over from the package. I needed to ensure that their package was called later in INSTALLED_APPS to make sure my templates were found first.
- Mostly the templates just worked by changing my copy of their templates to use my base template, and other cosmetic changes
- One minor gotcha was that the django-registration login template uses id_username as the field, whereas django-allauth uses id_login (since it can be either username or email)
- By default, allauth will produce a message for every action. Their base template displays these. I decided I didn’t want them; so following their instructions at http://django-allauth.readthedocs.org/en/latest/index.html?highlight=templates#messagesI replaced the provided templates with blanks.
- I added a redirect url from the old django-registration /accounts/register to the new django-allauth /accounts/signup
That was it. Much easier than I expected.