I'm on DreamHost, so I have only FastCGI available. But I'm wondering
what is the **current preferred way** of running Django in fcgi mode?
I followed Jeff Croft's/official DH tutorial and managed to run Django
on DH without any problems whatsoever. But I'm always looking for the
best (better) -- and now I saw this in the official docs:
<http://www.djangoproject.com/documentation/fastcgi/#running-django-on-a-shared-hosting-provider-with-apache>.
That looks cleaner to me, and requires flup and not that fcgi library
in single file as in original tutorial... But I simply can't get it to
work via this "new" way. The page just sits for a long time and then in
the end I get 500 app error. And it also seems to me that apache
rewrite rule is kinda wrong, it doesn't route you to fcgi script...
Any opinions, pointers?
It's hard to tell where your problem is occurring without seeing any
errors... can you check the server logs and post the error?
Just for reference, here is what my django.fcgi looks like if you want
to compare.
flup-r2028 holds the flup source, django-0.95 holds the django source,
and django_projects holds all my projects.
#!/usr/bin/python
import sys, os
sys.path += ['/home/timster/flup-r2028']
sys.path += ['/home/timster/django-0.95']
sys.path += ['/home/timster/django_projects']
os.environ['DJANGO_SETTINGS_MODULE'] = 'webapp.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(["method=threaded", "daemonize=false"])
This looks nice, many thanks! Can you *please* post your .htaccess file
also? Seems that you are using some mix between "old jeff croft" method
and new one from the official docs...
This will definitely help, I'll get back with results (probably
tomorrow -- when I finish my site).
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule ^(media/.*) - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]
OK, my django.fcgi and .htaccess are *exactly* like yours (with
slightly adjusted paths), and still, it doesn't work :( It just stalls
for a long time and then apache throws Internal Server Error.
Does .bash_profile make any difference?
1. Is the domain setup with "FastCGI Support?" in the Dreamhost Panel?
2. Are the permissions on django.fcgi set to 755?
Post the last 10 lines or so of ~/logs/yoursite.com/http/error.log This
will show any errors that were produced by django.fcgi
Yes.
> 2. Are the permissions on django.fcgi set to 755?
Yep.
> Post the last 10 lines or so of ~/logs/yoursite.com/http/error.log This
> will show any errors that were produced by django.fcgi
Here, I opened new thread (you can see error logs there):
http://groups.google.com/group/django-users/browse_thread/thread/ced5964945f795da/4b725d48be4ededf#4b725d48be4ededf