<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/root

        RewriteEngine On
        RewriteMap tolower int:tolower

        # Redirect all www.
        RewriteCond   %{HTTP_HOST}                 ^www\..*$
        RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
        RewriteRule   ^www\.(.*) http://$1 [R=301,L]

        # For all admin media
        RewriteRule ^/media(.*) /usr/share/python-support/python-django/django/contrib/admin/media$1 [L]

        # For each project's static files
        RewriteRule ^/static(.*) /var/www/${tolower:%{SERVER_NAME}}/static$1
        RewriteRule ^/favicon.ico /var/www/${tolower:%{SERVER_NAME}}/static/images/favicon.ico

        # For each project's documentation
        RewriteRule ^/docs(.*) /var/www/${tolower:%{SERVER_NAME}}/docs/build/html$1

        # For each project's WSGI hook
        RewriteRule ^/(?!var/www/)(.*) /var/www/${tolower:%{SERVER_NAME}}/apache/django.wsgi/$1
        RewriteRule . - [E=APPLICATION_GROUP:${tolower:%{SERVER_NAME}}]

        WSGIProcessGroup %{GLOBAL}
        WSGIApplicationGroup %{ENV:APPLICATION_GROUP}

        # Run mod_wsgi in daemon mode, with daemons named by the site name 
        WSGIDaemonProcess %{ENV:APPLICATION_GROUP} processes=5 threads=10 python-path=/path/to/common display-name=%{GROUP}

        <Directory /var/www/*/apache>
                Order allow,deny
                Allow from all
                Options ExecCGI
                AddHandler wsgi-script .wsgi
        </Directory>

        <Directory /var/www/*/docs>
                # You can protect the docs directories here
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
</VirtualHost>