by Ismail Elshareef
Django's database setting are by default set to work with relational databases. Therefore, certain issues start popping up when you work with noSQL databases, like MongoDB.
If you're running Django-nonrel with Mongodb, you will run into an issue when you execute the following command:
$ ./manage.py syncdb
The problem is, the SITE_ID in your settings.py needs to be set to something else to work with non-relational databases.
- Create a site entry
python ./manage.py shell
>>> from django.contrib.sites.models import Site
>>> Site().save()
- Grab the id of the Site record just created. Copy that value and put it in your settings.py.
>>> Site.objects.all()[0].id
u'4fe7aa759e654e2662000000'
- If you're working on Heroku, you'll want to set the same SITE_ID there too
$ heroku run python manage.py shell
>>> from django.contrib.sites.models import Site
>>> Site(id=u'4fe7aa759e654e2662000000').save()
>>> Site.objects.all()[0].id
u'4fe7aa759e654e2662000000'
Thanks, this worked well.