Changing Django's dynamic settings dynamically based on a query for multiple sites

Consult if it is changing the urlconf and templatedir variables of the django settings file dynamically as part of the user middleware function based on the requested site.

+1
source share
1 answer

Not. I do not know why you would like to do this. If you have multiple sites, the correct way to maintain them is to use multiple instances of WSGI, each of which points to separate settings.py and urls.py files.

Edit after comment: This has nothing to do with the site infrastructure, which is completely optional. As I said, if you want to serve multiple sites, use several .wsgi scripts, each of which points to separate urls.py and settings.py . The rest of the code may be the same.

+3
source

All Articles