Django has the sites framework to support multiple web site hosting from a single Django installation.
EDIT (below is an incorrect assumption of the system)
I understand that middleware sets the settings.SITE_ID value based on a lookup/cache of the request domain.
ENDEDIT
But when testing locally, I’m at http://127.0.0.1:8000/, not http://my-actual-domain.com/
How do I locally view my different sites during development?
Create a separate settings.py file for every site, including an appropriate
SITE_IDsetting. Of course you can use theimportstatement to share common setting between files.From now on, when running Django development server specify the
--settingsoption to tell Django which site to run.For example (assuming you’ve got two setting files – settings_first.py and settings_second.py):
will run the first site, and
will give you an access to the second site.
You can also run them simultaneously, specifying different ports:
The above commands (run on two different consoles) will make the first website accesible under http://127.0.0.1:8001/, and the second one under http://127.0.0.1:8002/