[Solved]-Django-allauth: How can I add a Site for my domain?

11👍

  1. Add a Site through the admin panel. Since I am developing on my machine, I’ve set up my site with the “Domain Name” field set as “127.0.0.1:8000” and the “Display Name” shouldn’t matter.

  2. Your SITE_ID in settings.py needs to match the actual database ID from the Site you added through the admin panel. To do this you can go to the details of the Site you created through the admin panel and look at the url for the ID number. Mine ended up being “5”(I recreated several sites trying to get this to work).

  3. Create a Social Application through the admin panel. This is pretty easy as you only need to setup an Application through the provider (e.g. create a Facebook app on Facebooks website) and use the secret code and app ID they give you to fill out the django form. Be sure to add the django Site you created in step 1 to the Social Application you are making in this step.

NOTE: I did this and kept getting a 404. This was due to me being logged in as an admin, thus, the url ‘/accounts/login’ decided I was already logged in and redirected to ‘/accounts/profile’ which didn’t exist yet. An easy fix if you run into this is to clear your cookies for your django page and visit ‘/accounts/login’ again. Post in comments if you need help.

👤Dylan

0👍

check if django.contrib.site has been added in the INSTALLED_APPs section in django settings

👤astr0

-2👍

Post-Installation

In your Django root execute the command below to create your database tables:

python manage.py syncdb

Now start your server, visit your admin pages (e.g. http://localhost:8000/admin/) and follow these steps:

  1. Add a Site for your domain, matching settings.SITE_ID (django.contrib.sites app).
  2. For each OAuth based provider, add a Social App (socialaccount app).
  3. Fill in the site and the OAuth app credentials obtained from the provider.

enter image description here

Leave a comment