Question

I have apache settings:

<VirtualHost *:80>
    ServerName site1.ru
    ServerAlias site2.ru

    WSGIScriptAlias / /path/to/wsgi.py
..

I want to load some host specific settings to django settings. So, how can i get HTTP_HOST (site1.ru or site2.ru) in django settings or in wsgi.py?

Was it helpful?

Solution

in wsgi.py

import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] ='project.settings'

OTHER TIPS

request.META['HTTP_HOST'], same as all the other headers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top