On Jan 6, 9:23 pm, kbochert <[EMAIL PROTECTED]> wrote:
> On Jan 5, 5:46 pm, Michael Hipp <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello,
>
> > I'm hoping to rework my website into Django, but am having trouble at my
> > shared hosting provider (HostMonster).
>
> > They don't support mod_python, so Hostmonster said to add this to .htaccess
> > for FastCGI:
>
> >    AddHandler fcgid-script .fcgi
>
> > I did that and my html sites still work, but when I add the recommendations
> > from Django my html sites don't work and neither does my fledgling Django 
> > site.
>
> >    AddHandler fastcgi-script .fcgi
> >    RewriteEngine On
> >    RewriteCond %{REQUEST_FILENAME} !-f
> >    RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
>
> > I also did the mysite.fcgi file. My Django site just returns blank pages. 
> > The
> > html sites get an 'Internal Server Error'.
>
> > I'm pretty sure my Django code works as it's just the simple stuff from
> > chapter 2 and 3 and it works on the development server.
>
> > Any help?
>
> > Thanks,
> > Michael
>
> I'm a beginner, and having my own fcgi problems but..
> You mention that your html site fails when yo add the rewrite rule to
> htaccess. As I understand it, the line
>    RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
> tells Apache that any url (i.e. '^(.*)$') is to be handled via
> mysite.fcgi, and so a sever error when trying to access an html file
> seems unsurprising. Perhaps something like
>
>    RewriteRule ^djangosite/(.*)$ mysite.fcgi/$1 [QSA,L]
>
> would only use the fcgi stuff on the urls that resolved to the
> djangosite directory???

You cannot read the RewriteRule in isolation, the RewriteCond on the
line before must be taken into consideration as well:

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]

The RewriteCond says that the RewriteRule should only be applied in
the target of the URL couldn't be mapped as a static file.

One problem with the rule as shown is that it may not necessarily work
on all cases. Can be a problem where done in a .htaccess file and that
directory isn't the root of the site.

If the URL of the directory is /dangosite, use instead:

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ /djangosite/mysite.fcgi/$1 [QSA,PT,L]

The PT flag should be optional because absolute path for redirect, but
makes it clearer when trying to look through mod_rewrite
documentation.

The question thus is, are you doing the rewrite rule in a .htaccess
file or not? Is that the root of the site?

Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to