Skip to main content
2 of 2
replaced http://stackoverflow.com/ with https://stackoverflow.com/
user avatar
user avatar

Yes, It is definitely possible. In our setup, typically we have django behind mod_wsgi, Apache and nginx

You can configure apache's Virtualhost, to point to a specific mod_wsgi which in turn points to specific code.

Quoting from here - Refer to the SO post for further information.

There are at least two methods you can try to serve from a single instance:

  1. Use apache + mod_wsgi and use the WSGIApplicationGroup and/or WSGIProcessGroup directives. I've never needed these before so can't be completely sure these will work the way you want, but regardless you can definitely use mod_wsgi in daemon mode to greatly improve your memory footprint.

  2. You can play with Django middleware to deny/allow URLs based on the request hostname (see HttpRequest.get_host() in the Django docs). For that matter, even though it would be a slight performance hit, you can put a decorator on all your views that checks the incoming host.

karthikr
  • 100.1k
  • 26
  • 208
  • 191