I am trying to deploy a simple static site on hostgator. I followed this tutorial and originally had in my .htaccess (where abc.com is the website):
AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On
RewriteRule (media/.*)$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(admin/.*)$ index.fcgi/$1 [L]
RewriteCond %{HTTP_HOST} ^abc\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.abc\.com$
RewriteRule ^/?$ "http\:\/\/abc\.com\/index\.fcgi" [R=301,L]
but this did not work and would only load the "home.html" from my template directory for some reason. When I tried to follow any links I would get a hostgator 404 error page. Then after doing some research and talking to the hostgator support people a few times I changed it to the much simpler:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/$1 [QSA,L]
My index.fcgi file in the public_html directory looks like:
#!/usr/local/bin/python
import sys, os, user
from django.core.servers.fastcgi import runfastcgi
sys.path.insert(0, "/usr/lib/python2.6")
sys.path.insert(0, "/home/joeshmo/django")
sys.path.insert(0, "/home/joeshmo/django/Projects")
sys.path.insert(0, "/home/joeshmo/django/Projects/PersonalWebsite")
# Switch to the directory of your project.
os.chdir("home/joeshmo/django/Projects/PersonalWebsite/")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "PersonalWebsite.settings"
runfastcgi(method="threaded", daemonize="false")
This worked, but now I am very curious what is going on here. Despite doing some research on my own I am confused what fcgi does and, more importantly, how it is telling django to load the proper html files from my template directory as the hostgator tech person I talked to assured me that html files could ONLY ever be accessed from the public_html folder. I am familiar with the general concept of a url dispatcher, regexp, views, ect but I am a self-taught web developer so please bear that in mind.