16

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?

user21398
  • 1,473
  • 4
  • 18
  • 31
  • 6
    Have you set SITE_ID=1 in settings.py? That is usually a default setting in the settings.py file, but if you are using another module, you may have to add that. – Aaron Lelevier Jan 08 '14 at 01:18
  • Maybe this help for you [http://stackoverflow.com/questions/14019017/django-allauth-no-facebook-app-configured-please-add-a-socialapp-using-the-djan?answertab=active#tab-top][1] [1]: http://stackoverflow.com/questions/14019017/django-allauth-no-facebook-app-configured-please-add-a-socialapp-using-the-djan?answertab=active#tab-top – Robert Jan 08 '14 at 09:42

2 Answers2

31

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.

Amir Nabaei
  • 1,582
  • 1
  • 15
  • 26
  • This is a correct solution. It helped me get rid of the error. I am surprised that this is not mentioned in Django Docs or probably I missed it. – pass-by-ref Apr 18 '14 at 18:38
  • @ShwetabhSharan It's described [here](https://docs.djangoproject.com/en/dev/ref/contrib/sites/#enabling-the-sites-framework) – Serhii Matrunchyk Mar 26 '15 at 10:33
  • I have the same problem. Where I must write SITE_ID = 1 in settings file, I do not understand where exactly? – DarioBB Jun 04 '15 at 08:22
1

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.

Tommy Gibbons
  • 184
  • 1
  • 2
  • 12