1

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?

khramov
  • 15
  • 3

2 Answers2

0

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

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
0
in wsgi.py

import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] ='project.settings'
drabo2005
  • 1,076
  • 1
  • 10
  • 16
  • i know this. But in wsgi.py want to set os.environ['HOST'] and then read it in settings – khramov Sep 06 '13 at 07:16
  • you have to define a middleware function like handler using HttpRequest.get_host() to be able to get it settings. – drabo2005 Sep 06 '13 at 07:19