Problem with non-flup WSGI handler and Django

13 views
Skip to first unread message

drums...@gmail.com

unread,
Apr 18, 2009, 1:43:22 AM4/18/09
to Django users
Hi,

I wrote a replacement for 'flup' to attach Django to IIS7 FastCGI. My
WSGI handler works OK with non-Django applications, but when I use
WSGIHandler from Django, I cannot resolve any URL under the root.
Problem, I believe, is in the following code:

In WSGIRequest.__init__
...
if not path_info or path_info == script_name:
# Sometimes PATH_INFO exists, but is empty (e.g. accessing
# the SCRIPT_NAME URL without a trailing slash). We really
need to
# operate as if they'd requested '/'. Not amazingly nice
to force
# the path like this, but should be harmless.
#
# (The comparison of path_info to script_name is to work
around an
# apparent bug in flup 1.0.1. Se Django ticket #8490).
path_info = u'/'
self.environ = environ
self.path_info = path_info
self.path = '%s%s' % (script_name, path_info)
...
In my case script_name is the same as path_info. This code sets
path_info to '/', later it tries to resolve it agains my rules in
urls.py, and expectedly fails. Which results in 404 for anything under
the root Url. Here is the code:

In BaseHandler.get_response
...
try:
callback, callback_args, callback_kwargs = resolver.resolve
(
request.path_info)
...
Here request.path_info is '/', somehow code tries to resolve it, but
not request.path.

How should I set environment parameters or urls.py patterns to get
through this issue?


Thanks,
Sergei

Graham Dumpleton

unread,
Apr 19, 2009, 1:18:08 AM4/19/09
to Django users


On Apr 18, 3:43 pm, "drumscan...@gmail.com" <drumscan...@gmail.com>
wrote:
From what I remember it is a fault in fastcgi for IIS that SCRIPT_NAME
isn't set properly. You should be looking at fixing this in your flup
replacement, not in Django.

Graham
Reply all
Reply to author
Forward
0 new messages