0

I'm new to Python and trying to setup Django on my VPS that is running CentoOS 6.5. My Apache version is 2.2.15. Python is running on version 2.7.

  • I created a virtualenv under /var/www/html/djangotest
  • I installed Django under the new virtualenv
  • I installed mod_wsgi, loaded the module, and created the following entry in my httpd.conf:
<VirtualHost *:80>
        WSGIDaemonProcess sampleapp python-path=/var/www/html/djangotest:/var/www/html/djangotest/env/lib/python2.7/site-packages
        WSGIProcessGroup sampleapp
        WSGIScriptAlias / /var/www/html/djangotest/sampleapp/wsgi.py
        DocumentRoot /var/www/html/djangotest/sampleapp
        ServerName django.domain.com
        ServerAlias www.django.domain.com
        ErrorLog /var/www/html/djangotest/error_logs
        <Directory /var/www/html/jdlferreira.com/djangotest>
            AllowOverride All
            Allow from all
        </Directory>
</VirtualHost>

Restarted apache with success, but visiting the url is returning me 503 Service Temporarily Unavailable.

The guide that I essentially followed is https://www.digitalocean.com/community/tutorials/how-to-run-django-with-mod_wsgi-and-apache-with-a-virtualenv-python-environment-on-a-debian-vps (adjustments were made for CentOS)

Where did I go wrong?

3
  • Does anything shows up on Apache error log?
    – ThoriumBR
    Aug 27, 2014 at 14:27
  • Nothing relevant under /var/log/httpd/error_log Aug 27, 2014 at 14:29
  • Do not set DocumentRoot to be the directory where your Django project code is. If you uncomment the WSGIScriptAlias directive, depending on what Apache access permissions are set to, someone could download your application code including your settings.py file with any database passwords in it. Aug 28, 2014 at 10:30

1 Answer 1

2

To anyone else having this issue, read the following: https://code.google.com/p/modwsgi/wiki/ConfigurationIssues

I resolved my issues by appending the following in my httpd.conf:

WSGISocketPrefix /var/run/wsgi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .