Dennis Kioko
Dennis Kioko

Reputation: 731

Hosting Django on a shared FastCGI host

I am trying to set up django shared hosting at iPage.com using FastCGI but I keep running into issue. The CGI script lods in the browser as text instead of executing. Below is the .htaccess and the fcgi script

.htacess

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

and below is the fcgi script

#!/usr/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home/users/web/b2374/ipg.navtejportfoliocom/django")

# Switch to the directory of your project. (Optional.)
os.chdir("/home/user/myproject")

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "tej.settings"

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

What am I not doing right?

Upvotes: 3

Views: 2997

Answers (3)

vdboor
vdboor

Reputation: 22526

Have you enabled execute permissions on the file? In your FTP client, enable the "execute" bit for user/group/others. Otherwise apache will think it just needs to serve the file instead.

If you have Linux shell access, you can also do chmod +x mysite.fcgi.

Upvotes: 1

Daniel Roseman
Daniel Roseman

Reputation: 599480

Javier is right, this won't work. The documentation on how to deploy with FastCGI is here - you need to install flup then run the FastCGI server inside Django.

Upvotes: 0

Javier
Javier

Reputation: 62573

you say FastCGI, but you're using CGI methods. FastCGI isn't a faster CGI implementation, they're two totally different things.

Upvotes: 0

Related Questions