unicode - Django view param is not unquote with FastCGI -
i have django site in nginx+fastcgi, , if there special char in url view param parsed django not unquoted.
example:
# python manage.py runfcgi port=8099 --settings=settings browser url: http://127.0.0.1/contact/%e6%9c%b1/ django urlpattern: url(r'^(?i)contact/(?p<q>.*)/$', 'qsearch'),
param 'q' catched qsearch function u'%e6%9c%b1'. expected u'\u6731' unquoted.
the same program works fine u'\u6731' when using runserver debug. have use workaround method:
q = unicode(urllib.unquote(str(q)), 'u8')
nginx conf:
location / { fastcgi_pass 127.0.0.1:8099; include /home/fastcgi_django.conf; }
fastcgi_django.conf:
fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_param query_string $query_string; fastcgi_param request_method $request_method; fastcgi_param content_type $content_type; fastcgi_param content_length $content_length; fastcgi_param request_uri $request_uri; fastcgi_param document_uri $document_uri; fastcgi_param document_root $document_root; fastcgi_param server_protocol $server_protocol; fastcgi_param gateway_interface cgi/1.1; fastcgi_param server_software nginx/$nginx_version; fastcgi_param remote_addr $remote_addr; fastcgi_param remote_port $remote_port; fastcgi_param server_addr $server_addr; fastcgi_param server_port $server_port; fastcgi_param server_name $server_name;
dont know problem nginx or django or fastcgi interface. hope can help.
charlie
Comments
Post a Comment