2

I recently started developing Django websites and I want to deploy them on a CentOS VPS with mod_wsgi and Apache.

I followed this guide and it works perfectly, but I would like to have more than one Django website running at the same time, so I tried to create multiple virtual hosts inside a proper config file, and there comes the problem.

<VirtualHost the.ip.of.server:80>
    ErrorLog /root/praxis.error.log

    Alias /static /root/Praxis/static
    <Directory /root/Praxis/static>
        Require all granted
    </Directory>

    <Directory /root/Praxis/Praxis>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess Praxis python-path=/root/Praxis:/root/Env/Praxis/lib/python2.7/site-packages
    WSGIProcessGroup Praxis
    WSGIScriptAlias /praxis /root/Praxis/Praxis/wsgi.py
</VirtualHost>

If I delete the VirtualHost opening and closing tag the site will work as expected, but if I keep those tags I will constantly receive a 404 error.

I really don't understand why everything works fine only without tags.

I also tried to switch between IP-based virtual hosting and name-based virtual hosting but nothing changed.

Here follows also wsgi.py

wsgi.py

import os

from django.core.wsgi import get_wsgi_application

sys.path.append('/root/Praxis/Praxis')

os.environ['PYTHON_EGG_CACHE'] = '/root/Praxis/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'Praxis.settings'

application = get_wsgi_application()

In my httpd.conf file I also have:

Listen 80

ServerName ip.to.the.server #without port specified

and

#NameVirtualHost *:80 <-- THIS IS A COMMENT RIGHT NOW

Thank you all in advance for the effort, I hope someone will be able to help me, I'm struggling with this so hard! Thank you guys.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
user256472
  • 21
  • 3
  • Welcome to [sf]. This is not a forum. Answers belong in the Answers section below, not in your question where they can be missed. – Michael Hampton Apr 29 '16 at 08:57

0 Answers0