Setting up Django-Allauth

Well, we are now in the project phase and I’ve been looking for a solution to using authentication with my Django web application and after many days of research, I’ve finally settled on django-allauth,

‘”Why?”, you ask? Well, it was the only one I was able to figure out.

Because I am a new developer, I tend to over think things, and setting up django-allauth took me a few days to get working but looking back on it now, it’s not all that hard. The documentation on Github is great, for the most part, but I found that there are some bits that were unclear so here is what I did to get going.

First you need to install django-allauth

pip install django-allauth

One you have everything installed, go into your project directory.

$ cd documents/list_hub

A little side note: The django-allauth package has it’s own templates which is super handy, eventually you may want to customize them but in the meantime just grab the source code from Github and copy just the templates directory into your project directory and customize those files later if you are so inclined.

Once you’re inside your project directory, find your file and input the following:

    # This is required by allauth template tags
    # These are allauth specific context processors


    # Needed to login by username in Django admin, regardless of `allauth`
    # `allauth` specific authentication methods, such as login by e-mail

    # The Django sites framework is required
    # ... include the providers you want to enable:

# Don't forget the SITE_ID (A model for storing the domain and name attributes of a Web site. 
#The SITE_ID setting specifies the database ID of the site object associated with that particular #settings file.)

Then add the allauth/templates directory to your file:

# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.

Then in your file add the following lines:

urlpatterns = patterns('',
    (r'^accounts/', include('allauth.urls')),

While still in your Django root execute the command below in your terminal to create your database tables:

python syncdb

and then run:

python run server

Once your server is running, visit your admin pages (e.g. http://localhost:8000/admin/)

Look! Now you have Django setup with django-alluth! Since you’re here, jump into your Django admin and start configuring your app APIs. This should mimic the providers in the INSTALLED_APPS section of your file and if you have no idea what I am talking about then you probably haven’t set up your apps yet. Go ahead and do that, i’ll wait.

Each providers interface for registering apps is different but for right now we just need a couple of things, such as, the Client ID and the Secret Key (Don’t share these values with anyone! It’s secret for a reason) once you have those in hand you can add those values to the “social app” section here — in the top right hand corner you’ll see the “add social app” button, click the button, and select a provider from the list provided, if you don’t see the provider your’e looking for then you haven’t added it to the INSTALLED_APPS section in your file.

Screen Shot 2014-03-24 at 2.48.28 PM

Note: You should also swap out the default site ( for localhost:8000, and add it to ‘sites’ in your Django admin panel

TADA!! You can now log in using your providers credentials.


  • Michelle Glauser

    I definitely could have used this a couple of weeks ago. My auth is still a mess, but I’ve no time right now to clean it up. I’m bookmarking this post, thanks!

  • randy

    When I try to make migrations with django 1.7, I get a permission denied by trying to create a migration in the library. Migrating without those gives me an Invalid Bases Error. Any suggestions?

  • Mazulo

    Amazing! You help me to find the solution about the templates. Thank you so much 😀