Sunday, May 27, 2012

a problem when PATH_INFO == SCRIPT_NAME

I'm using Django-1.4 and nginx with fastcgi mode.
when I use runserver mode everything goes well, But in nginx &
fastcgi ,whatever URL i visit, I get a response "/"
I trace the code and found that , when PATH_INFO == SCRIPT_NAME,
path_info has been set to u'/' (core/handlers/wsgi.py WSGIRequest
__init__)
so all the request redirect to /
for example , I visit /foo/, nginx send a fastcgi request with
PATH_INFO = '/foo/' & SCRIPT_NAME = '/foo/' ,and Django redirect it
to '/'
I change :

if not path_info or path_info == script_name :
path_info = u'/'
to:

if not path_info :
path_info = u'/'
if path_info == script_name:
script_name = u''

I found this problem has been reported and fixed in
https://code.djangoproject.com/ticket/8490,
but he treat it in a strange way, i'm still wondering it's a django bug or not.

excuse for my pool english :)

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