Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django virtual host setup. Apache mod_wsgi

I am hoping there is a simple answer to my question as I am not the most experienced with python and Apache.

I am trying to hook up Apache with mod_wsgi. I have used a virtual host to do so. see below:

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName  testserver.com/django
#DocumentRoot /
WSGIScriptAlias / /home/mycode/mysite/scripts/django.wsgi
Alias /media/ /home/mycode/mysite/mysite/media/
Alias /adminmedia/  /opt/python2.7/lib/python2.7/site-packages/django/contrib/admin/media/
<Directory "/home/mycode/mysite/mysite/media">
     Order deny,allow
     Allow from all
    </Directory>
</VirtualHost>

This works great for my django project when I go to testserver.com instead of my php index page I get my django project.

What I am looking for is help with allow my php projects in /var/www/html/ and my django projects to coexist. I am trying to make it so to reach my django project I type testserver.com/django

Any help or guidance is greatly appreciated :)

Thanks!

like image 653
Mat A Avatar asked Apr 09 '12 23:04

Mat A


1 Answers

Change:

WSGIScriptAlias / /home/mycode/mysite/scripts/django.wsgi

to:

WSGIScriptAlias /django /home/mycode/mysite/scripts/django.wsgi

The first argument is the mount point, you have it to be the root of the web server, so just change it to '/django' instead.

like image 106
Graham Dumpleton Avatar answered Oct 30 '22 18:10

Graham Dumpleton