0

I am trying to deploy a django project under a sub-URL on hostgator hosting. Here is the tutorial I was following: http://support.hostgator.com/articles/django-with-fastcgi

My index.fcgi looks like this:

#!/usr/bin/python2.7
import sys, os

sys.path.insert(0, "/home/my_project_dir")
sys.path.insert(0, "/home/my_project_dir/my_project/")
os.chdir("/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 www.mydomain.com/dir/sub/ I get a 404 Resource not found error.

Irfan
  • 135
  • 1
  • 4

1 Answers1

0

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

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

or

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

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

Tom
  • 11,176
  • 5
  • 41
  • 63