In Djano, why do I get a 500 server error when browsing, but "python mysite.fcgi" from SSH works fin

Posted by Jim on Server Fault See other posts from Server Fault or by Jim
Published on 2010-02-26T22:02:48Z Indexed on 2010/04/01 21:03 UTC
Read the original article Hit count: 294

Filed under:
|
|

If I browse to my site, I get a 500 "internal server error." However, if I SSH into my server and go to my site's folder and run "python mysite.fcgi" I see the HTML rendered fine. Obviously, something is wrong, but I'm not sure what.

Here is my .htaccess file:

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

Here is my mysite.fcgi file:

#!/usr/bin/python2.5
import sys, os
sys.path.insert(0, "/kunden/homepages/34/[mydir]/htdocs/projects/django")
sys.path.insert(1, "/kunden/homepages/34/[mydir]/lib/python/site-packages")
os.chdir("/kunden/homepages/34/[mydir]/htdocs/projects/django/mysite")
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(["method=threaded", "daemonize=false"])

I'm setting this up on 1and1. It has been a pain, but I think I'm close.

© Server Fault or respective owner

Related posts about django

Related posts about apache