Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-allauth SITE_ID error

I'm learning django and have decided to use django-allauth for user registration. I currently only want local accounts (I've excluded social auth from settings.py).

When I access /accounts/login I get the following error:

You're using the Django "sites framework" without having set the SITE_ID setting. Create a site in your database and set the SITE_ID setting to fix this error.

The Official Django docs say:

The ID, as an integer, of the current site in the django_site database table. This is used so that application data can hook into specific sites and a single database can manage content for multiple sites.

But I don't quite understand this. Right now I'm just running django in a development environment, and normally just doing python manage.py runserver gets things running and I can test my app.

How do I fix this SITE_ID issue with local accounts? Would the solution be different in production/development environments?

like image 986
user21398 Avatar asked Jan 08 '14 00:01

user21398


People also ask

What is Allauth in Django?

django-allauth is an integrated set of Django applications dealing with account authentication, registration, management, and third-party (social) account authentication. It is one of the most popular authentication modules due to its ability to handle both local and social logins.

What is site ID in Django-Allauth?

Create a site in your database and set the SITE_ID setting to fix this error. The Official Django docs say: The ID, as an integer, of the current site in the django_site database table. This is used so that application data can hook into specific sites and a single database can manage content for multiple sites.

How do I find my Django site ID?

You can find the site_id in the address bar.


1 Answers

Adding "SITE_ID = 1" to your settings will get you past the exception without having to add it to INSTALLED_APPS. It worked for me.

like image 184
Amir Nabaei Avatar answered Sep 18 '22 12:09

Amir Nabaei