3

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.

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.

2
  • Do you have a separate Apache conf for the Wordpress site? Commented Jul 31, 2015 at 10:29
  • @DanielRoseman: Yes, and here it is: pastie.org/private/kaece7lmmwenhkumtfesq Commented Aug 1, 2015 at 20:53

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I've been struggling with this a long time, but yes, you are actually right, it solved my problem! Thank you so much for helping me :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.