Monday, February 6, 2012

Multiple Django Virtual Hosts on Apache+mod_wsgi but only one gets served

I've been struggling to figure out the following problem and am hoping
someone else has seen this.

I have a server running Apache 2 w/mod_wsgi. I've setup multiple,
different Django apps. Each has its own virtual host configuration
(see below).

This is on a local test server and my client machines have /etc/hosts
configured to point both app_a and app_b hostnames to the same
machine.

The problem I have is that Apache is only serving app_a regardless of
whether I go to app_a or app_b in my browser.

Has anyone seen anything like this?

P.S. When configured as plain, vanilla virtual hosts (i.e., no
mod_wsgi) the virtual hosting works just fine.


<VirtualHost *:80>
ServerName app_a

<Directory /home/app_a/public_html/app_a/static>
Order deny,allow
Allow from all
</Directory>

<Directory /home/app_a/public_html/app_a/media>
Order deny,allow
Allow from all
</Directory>

<Directory /home/app_a/public_html/app_a>
Order deny,allow
Allow from all
</Directory>

LogLevel warn
ErrorLog /home/app_a/public_html/app_a/logs/apache_error.log
CustomLog /home/app_a/public_html/app_a/logs/apache_access.log
combined

WSGIDaemonProcess app_a user=www-data group=www-data threads=20
processes=2 display-name=app_a
WSGIProcessGroup app_a

WSGIScriptAlias / /home/app_a/public_html/app_a/app_a/app.wsgi
</VirtualHost>

<VirtualHost *:80>
ServerName app_b

<Directory /home/app_b/public_html/app_b/static>
Order deny,allow
Allow from all
</Directory>

<Directory /home/app_b/public_html/app_b/media>
Order deny,allow
Allow from all
</Directory>

<Directory /home/app_b/public_html/app_b>
Order deny,allow
Allow from all
</Directory>

LogLevel warn
ErrorLog /home/app_b/public_html/app_b/logs/apache_error.log
CustomLog /home/app_b/public_html/app_b/logs/apache_access.log
combined

WSGIDaemonProcess app_b user=www-data group=www-data threads=20
processes=2 display-name=app_b
WSGIProcessGroup app_b

WSGIScriptAlias / /home/app_b/public_html/app_b/app_b/app.wsgi
</VirtualHost>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment