Deploy Django Application along with WordPress (at suburl)

In my company we have a server with public IP and Wordpres installed on it. WordPress url is like www.companyblog.org and works fine.

However, I need to deploy on the same server Django application at url: www.companyblog.org/testproject.

Read More

I’m using Ubuntu 12.04 LTS and Apache 2.2.

Here’s my virtual host configuration for my Django application:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName companyblog.org
        ServerAlias www.companyblog.org

        DocumentRoot /var/www/wordpress/public_html

        WSGIScriptAlias /testproject /home/mazix/djangoprojects/testproject/testproject/wsgi.py

        <Directory /var/www/wordpress/public_html>
                Order allow,deny
                allow from all
        </Directory>

        <Directory /home/mazix/djangoprojects/testproject>
            Order allow,deny
            Allow from all
        </Directory>

        ErrorLog /var/log/error.log
        LogLevel warn
        CustomLog /var/log/access.log combined

</VirtualHost>

And problems I have … :

  1. When WordPress site is enabled at www.companyblog.org and Django app site is enabled at www.companyblog.org/testproject, I’m getting the famous WordPress error: This is somewhat embarrassing, isn’t it? It seems we can’t find what you’re looking for. Perhaps searching, or one of the links below, can help.
  2. When WordPress site is disabled at www.companyblog.org and Django app site is enabled at www.companyblog.org/testproject I can access the test Django website, so it works fine.

I haven’t changed the default Django application project. I didn’t change the urls.py, wsgi.py, etc. – none of them was changed. I’ve only added WSGIPythonPath /home/mazix/djangoprojects/testproject to /etc/apache2/apache2.conf file.

Related posts

1 comment

  1. You can’t have two VirtualHosts listening to the same port/servername. You need to combine them into one file; that’s probably as simple as copying the WSGIScriptAlias line into the other VirtualHost.

Comments are closed.