doableware/djongo

Django (sites.E101) The SITE_ID setting must be an integer

Jcbobo opened this issue · 1 comments

One line description of the issue

(sites.E101) The SITE_ID setting must be an integer

Python script

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
]
SITE_ID = '627cb66b6546163cb291f918'

Traceback

 Exception in thread django-main-thread:
 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
     self.run()
   File "/usr/local/lib/python3.9/threading.py", line 910, in run
     self._target(*self._args, **self._kwargs)
   File "/usr/local/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
     fn(*args, **kwargs)
   File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
     self.check(display_num_errors=True)
   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 558, in check
     raise SystemCheckError(msg)
 django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:
 
 ERRORS:
 ?: (sites.E101) The SITE_ID setting must be an integer

Go to your MongoDB database, and then collection named django_site, then remove existing one and manually add a new document with "_id": 1.
You can also just simply clone the existing one and just change "_id": ObjectID("...") to int32 and set the _id to 1. Just like this

And now you can set SITE_ID = 1 in settings.py