2👍
From documentation: Altering settings at runtime.
You shouldn’t alter settings in your applications at runtime.
from django.conf import settings
settings.DEBUG = True # Don't do this!
The only place you should assign to settings is in a settings file.
I think the best way is make several settings-file:
File base_settings.py
:
... all your settings for all sites ...
File first_site_settings.py
:
from base_settings import *
SITE_ID = 1
... other settings for this site ...
File second_site_settings.py
:
from base_settings import *
SITE_ID = 2
... other settings for this site ...
And run each site as a separate djano-process:
$ python mysite/manage.py runserver --settings=mysite.first_site_settings
$ python mysite/manage.py runserver --settings=mysite.second_site_settings
Source:stackexchange.com