You've found my spot on the internet that's all about me. I put together this little site to show off my work and keep track of my various projects.

Apache Config For Two Django Sites on the Same Server

Recently, I had a need to create two separate Django projects. The requirements were similar but dissimilar enough that I wanted to have two projects rather than two apps in the same project. I decided to try and work with Apache to get the two sites running side-by-side on the same server.

Using two virtual environments, using the same process described here, my apache config looks like the following.

Project 1 is called Overview found at “/SRM” while Project 2 is codenames at “/codenames”.

<VirtualHost *:80>

  ServerName Overview
  ServerAlias overview.labs.lenovo.com/SRM

  Alias /static/ /var/www/html/Overview/static/

  <Directory /var/www/html/Overview/static>
    Order deny,allow
    Allow from all

  <Directory /var/www/html/codenames/static>
    Order deny,allow
    Allow from all

  WSGIDaemonProcess codenames python-path=/home/Django/codenames:/home/virtualenvs/django_env/lib/python2.7/site-packages
  WSGIScriptAlias /codenames /home/Django/codenames/codenames/wsgi.py process-group=codenames

  WSGIDaemonProcess Overview python-path=/home/Django/Overview:/home/virtualenvs/django_env/lib/python2.7/site-packages
  WSGIScriptAlias /SRM /home/Django/Overview/Overview/wsgi.py process-group=Overview

  <Directory /home/Django/Overview/Overview>
    <Files wsgi.py>
      Order deny,allow
      Allow from all


So far so good.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: