503 Error: Service Temporarily Unavailable (Mod_wsgi, Apache, Django)

5,995

I had the same problem (Service Temporarily Unavailable).
I found the solution here:
https://code.google.com/p/web2py/source/browse/scripts/setup-web2py-fedora.sh At line 373.

echo "WSGISocketPrefix run/wsgi" >> /etc/httpd/conf.d/wsgi.conf
Share:
5,995

Related videos on Youtube

thinkux
Author by

thinkux

Updated on September 17, 2022

Comments

  • thinkux
    thinkux over 1 year

    I followed the tutorial to mount a Djando application on Apache here. The Django project was created under its own directory in /opt. Any suggestions or other tutorials I can use? I reviewed few tutorials on the Django site with no success. The application does not serve any static pages, just receives requests. However, we did setup a test file to check if the app is working in urls.py. I get a 404 error.

    Error:

    Service Temporarily Unavailable

    The server is temporarily unable to service your request due to maintenance downtime or > capacity problems. Please try again later.

    Here is the current configuration is set: app.wsgi

    import os, sys
    
    sys.path.append('/opt/<APPLICATION>')
    sys.path.append('<PATH TO PYTHON INSTALL>/django')
    
    os.environ['DJANGO_SETTINGS_MODULE'] = '<APPLICATION>.settings_production'
    
    import django.core.handlers.wsgi
    
    application = django.core.handlers.wsgi.WSGIHandler()
    
    • OS: CentOS
    • Python: 2.7
    • Framework: Django
    • Mod: MOD_WSGI
    • WebServer: Apache

    Apache Entries:

    LoadModule wsgi_module modules/mod_wsgi.so
    AddHandler wsgi-script .wsgi
    
    WSGIDaemonProcess server threads=25 display-name=%{GROUP}
    WSGIProcessGroup server
    
    WSGIScriptAlias / /opt/<APPLICATION>/<APPLICATION>.wsgi
    
    <Directory /opt/<APPLICATION>>
      Order allow,deny
      Allow from all
    </Directory>
    

    Please let me know if I am missing anything or if I can supply any other data.

    After further research I found the issue is with creating a socket as Apache may not have access to do so. I tried using the:

    WSGISocketPrefix /tmp/wsgi
    

    , but I receive a 500 Internal Error, thoughts?

    Thank-you

    • diomonogatari
      diomonogatari about 13 years
      What are you seeing when you visit your webpage? Blank page, <% sometag %>? Also try setting DEBUG=true in your settings file to see if you can a more descriptive error.