Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

FYI. Enabling the sites framework has been changed in Django v1.6 see here for details... https://docs.djangoproject.com/en/1.6/ref/contrib/sites/

Once you have added 'django.contrib.sites', to your INSTALLED_APPS then the domain will be created in the database, id = 1, domain = example.com, name = example.com.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top