On Oct 12, 10:50 pm, Graham Dumpleton <
graham.dumple...@gmail.com>
wrote:
> 2009/10/13 JSL <
t...@pricegoblin.co.uk>:
>
>
>
> > Hi, i'm switching my mod_python apache setup to use mod_wsgi using
> > django as the framework. All was working well until except it seems
> > for one part. I have a redirect function which accepts another url
> > such as
>
> > /redirect/
http://www.google.com
>
> > this worked fine with mod_python, but for some reason with mod_wsgi
> > the 2 slashes get squashed to one (in fact any number get squashed)
>
> > Is there something i've missed?
>
> That is how Apache works. If it worked on mod_python before then
> Django must have been side stepping the normal variables a Python web
> applications should use, especially WSGI applications, and using the
> unescaped REQUEST_URI variable. One shouldn't as a rule rely on
> REQUEST_URI.
>
> Also make sure you read this discussion:
>
>
http://groups.google.com/group/python-web-sig/browse_frm/thread/2003e...
>
> as it talks about this very issue and how you can work around it by
> using custom encoding of URL information.
Hi, thanks for the answer, after some digging it appears that
mod_rewrite strips out the double slashes (googling around didn't
point me in the direction of where or why - if anyone knows so i could
turn it off, i'd be grateful - it looks as though it treats it as a
file name in a subrequest).
When it does this, the django base handler creates calculates the
script_name variable as being the first x characters where x is the
number of characters removed from the rewritten url.
I've fixed it by setting FORCE_SCRIPT_NAME to the empty string
Thanks
JOHN