title: Django on Apache with FCGI
body: <p><strong>Solved:</strong> Unfortunately I wasn't able to solve the problem but I started over and followed the <a href="http://wiki.asmallorange.com/HOWTODjangoFastCGI" rel="nofollow noreferrer">Django + FastCGI guide</a> on the <a href="http://wiki.asmallorange.com/Welcome" rel="nofollow noreferrer">"A Small Orange" wiki</a> and everything is working as expected.</p>
  
  <p>I am trying to setup Django with FCGI on Apache. The web hosting plan that I am using is A Small Orange's shared hosting plan.</p>
  
  <p>Django is installed, working and is able to create database tables when I run the syncdb command. If I run <code>manage.py runserver</code> and then use lynx to navigate to <code>localhost:8080</code> django will correctly display. However, It is not possible to view django over the internet as the page displays a 500 internal server error.</p>
  
  <p>I have the flup python package installed and am using python version 2.6.</p>
  
  <p>The following is the contents of my .htaccess file that is situated in <code>/public_html/</code>:</p>
  
  <pre><code>RewriteEngine On
    RewriteBase /
    RewriteRule ^(media/.*)$ - [L]
    RewriteRule ^(admin_media/.*)$ - [L]
    RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
    RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
  </code></pre>
  
  <p>The following is the contents of my dispatch.fcgi file that is also located in <code>/public_html</code>:</p>
  
  <pre><code>#!/usr/local/lib/python2.6
  import sys
  import os
  os.chdir('/home/thegamer/django/projects/thegamer')
  sys.path += ['/home/thegamer/django/django']
  sys.path += ['/home/thegamer/django/projects']
  from fcgi import WSGIServer
  from django.core.handlers.wsgi import WSGIHandler
  import os
  os.environ['DJANGO_SETTINGS_MODULE'] = 'thegamer.settings'
  WSGIServer(WSGIHandler()).run()
  </code></pre>