Current *preferred* fcgi setup, lets settle this once for all

Skip to first unread message

sime

unread,
Aug 15, 2006, 1:49:14 PM8/15/06
to Django users
Hello,

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?

Tim Shaffer

unread,
Aug 15, 2006, 3:28:55 PM8/15/06
to Django users
I am using Dreamhost and just recently switched from the "old" way to
the "new" way that uses flup. I haven't had any problems.

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"])

sime

unread,
Aug 15, 2006, 3:39:53 PM8/15/06
to Django users
Tim Shaffer wrote:
> 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.
>
> [snip]

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).

Tim Shaffer

unread,
Aug 15, 2006, 4:37:52 PM8/15/06
to Django users
Here is my .htaccess file... let me know if you have any questions.

AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule ^(media/.*) - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]

sime

unread,
Aug 16, 2006, 5:37:54 PM8/16/06
to Django users
Tim Shaffer wrote:
> Here is my .htaccess file... let me know if you have any questions.

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?

Tim Shaffer

unread,
Aug 17, 2006, 10:56:45 AM8/17/06
to Django users
It shouldn't. Here are a couple other things to check, just in case
it's something simple.

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

sime

unread,
Aug 17, 2006, 11:02:48 AM8/17/06
to Django users
Tim Shaffer wrote:
> 1. Is the domain setup with "FastCGI Support?" in the Dreamhost Panel?

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

Reply all
Reply to author
Forward
0 new messages