Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to deploy a django project under a sub-URL on hostgator hosting. Here is the tutorial I was following:

My index.fcgi looks like this:

import sys, os

sys.path.insert(0, "/home/my_project_dir")
sys.path.insert(0, "/home/my_project_dir/my_project/")
os.environ['DJANGO_SETTINGS_MODULE'] = "my_project.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

And the .htaccess looks like this:

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]

Both of these files placed in a sub-direcotry /home/my_project_dir/public_html/dir/sub/ Problem is that when I try to access I get a 404 Resource not found error.

share|improve this question

grep for the 404 message in your access_log files, it will indicate whether the RewriteRule matched or not.

grep " 404 " access_log

either you will see - - [11/May/2012:23:50:56 +0100] "GET /index.fcgi/XXXX HTTP/1.1" 404 123

or - - [11/May/2012:23:50:56 +0100] "GET /XXXX HTTP/1.1" 404 123

the second ones indicates that the rewrite didn't match...

share|improve this answer
The rewrite does matches and I am getting this in error log: File does not exist: /home/my_project_dir/index.fcgi/the_url/ – Irfan May 21 '12 at 10:27
make sure you can execute index.fcgi; chmod +x index.fcgi – Tom H May 21 '12 at 10:31
it is executable, I can run it manually ./index.fcgi – Irfan May 21 '12 at 10:36
what happens in the logs and response, if you call ? – Tom H May 21 '12 at 10:39
response prints the contents of fcgi file. I am not sure why it is not executing it – Irfan May 21 '12 at 10:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.