Migrating from django-registration to django-allauth

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:

  • Django==1.5.1
  • django-registration==1.0

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:

  1. Set up django-allauth as per their documentation at http://django-allauth.readthedocs.org/
  2. Removed the django-registration module from the settings
  3. 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.
  4. Mostly the templates just worked by changing my copy of their templates to use my base template, and other cosmetic changes
  5. 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)
  6. 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.
  7. 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.

Thanks!

3 thoughts on “Migrating from django-registration to django-allauth”

  1. I’m considering right now doing the same.
    I’m hesitating between django-allauth and python-social-auth.
    Do you know what are the pros and cons?

    Thanks a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *