Sunday, January 1, 2012

Apache RewriteRule for django

I'm moving a django site to a shared hosting server, where I'll need
to use fastcgi (the site on the original server is using mod_python,
which isn't available on the shared hosting server). I have found the
instructions for setting this up, but it's not working. I'm getting
"The requested URL /appname/appname.fcgi/admin was not found on this
server" (I'm using "appname" instead of the real name). The rewrite
rule is:

RewriteRule ^(.*)$ appname.fcgi/$1 [QSA,L]

In light of this rule, which is taken straight from the Django Book,
I'm not surprised by the error message. All the other RewriteRules
I've seen/used in the past put the requested resource in the query
parameter; for example, Drupal uses

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

which makes sense: Apache will load index.php and pass it "q=what-you-
asked-for" but in the rule given above for django the forward slash in
the replacement string is going to cause Apache to look for something
that doesn't exist, instead of appname.fcgi, which does exist.

Please tell me what I'm missing!

Thanks!

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

No comments:

Post a Comment