Django and fastcgi .fcgi script not working in browser

Hi I want to implement django on an apache share host server using fastcgi. I have implemented something similar to (this)[] tutorial.

I have wordpress as my primary site in my ‘public_html’ folder but i want to have django running in a sub directory in this folder so i have another directory ‘mydjsite’ as a sub directory and it contains


import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home/myusername/python27")
sys.path.insert(13, "/home/myusername/DjangoProjects/myproject")
sys.path.insert(14, "/home/myusername/python27/lib/python2.7/site-packages")

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false",debug="true") 


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

Running [~]# ./mysite.fcgi returns the django welcome page in the shell but when i visit the site at i get the 404 page of my wordpress site. The .htaccess file in the public_html folder contains


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

is there something i am missing in this file? When i remove this file and try to access my django site the I get the error page

Not Found

The requested URL /mydjsite/mysite.fcgi/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I assume the .fcgi script is fine since it works form the shell fine. I just dont see the page in my browser

Source: .htaccess

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.