#8874 closed Uncategorized (invalid)
problem with URLs on FastCGI after update to 1.0
Reported by: | kyprizel | Owned by: | kyprizel |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | qingfeng@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
all URI resolve to root(/) after updating django from beta to 1.0-release.
here is part of urls.py:
urlpatterns = patterns('', (r'^$', 'src.views.main_index'), (r'^feedback/$', 'src.views.feedback'), (r'^admin/(.*)', admin.site.root) )
trying to access /feedback/ but always get result of 'src.views.main_index'.
Attachments (4)
Change History (22)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
I use nginx web server, configured to use the same PATH_INFO and SCRIPT_NAME,
so http://code.djangoproject.com/ticket/8490 made problems for me.
Is my config incorrect?
comment:3 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 16 years ago
Has patch: | set |
---|
comment:5 by , 16 years ago
Keywords: | error removed |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:7 by , 16 years ago
Has patch: | set |
---|
comment:8 by , 16 years ago
I don't believe this patch is really fixing the root problem. It looks like it's forcing script name to an incorrect value and just kind of works by accident.
The real question here is why does script name have a value of feedback/
? That looks like either a configuration bug or a bug in nginx or something. We need to understand that a bit better before working out a solution to this problem.
comment:9 by , 16 years ago
Triage Stage: | Design decision needed → Accepted |
---|
(Moving out of design decision needed, since this is either a bug or not. If it's a bug, we should fix it. There's no design decision needed, just a proper understanding and solution.)
by , 15 years ago
Attachment: | wsgi_r11339.diff added |
---|
comment:10 by , 15 years ago
milestone: | → 1.2 |
---|---|
Version: | 1.0 → SVN |
follow-up: 12 comment:11 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
fixed #8490
comment:12 by , 15 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
comment:13 by , 15 years ago
nginx+django project conf file:
http://code.djangoproject.com/attachment/ticket/8874/nginx.conf
http://code.djangoproject.com/attachment/ticket/8874/sina.conf
urls.py:
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^hello/', 'demo.views.hello'), )
demo/views.py
from django.http import HttpResponse def hello(request): return HttpResponse("Hello")
Django 1.1 Test:
curl -I http://localhost/hello
Restuls:
HTTP/1.1 404 NOT FOUND Server: nginx/0.7.62 Date: Wed, 16 Sep 2009 09:23:29 GMT Content-Type: text/html Connection: keep-alive
use new patch:
http://code.djangoproject.com/attachment/ticket/8874/wsgi_r11339.diff
curl -I http://localhost/hello
Results:
HTTP/1.1 200 OK Server: nginx/0.7.62 Date: Wed, 16 Sep 2009 10:27:11 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive Vary: Cookie
comment:14 by , 15 years ago
The correct config for nginx. If you uncomment commented strings you fall into very strange and scarry bugs(ex. RequestContext will go down or url-tag will do strange things). I'm posting it here as I spent 4 days to catch all problems with fcgi and solutions in the internet didn't work for me.
location / { #DO NOT INCLUDE include /etc/nginx/fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_URI $request_uri; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; #DO NO SET fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param PATH_INFO $uri; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PORT $server_port; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_pass unix:/home/exe_messir_net/tmp/fcgi.sock; }
comment:15 by , 15 years ago
It should at least be documented on perhaps the server configuration documentation page that you can't define both PATH_INFO and SCRIPT_NAME when using nginx fastcgi. This caused django to fail in a bewildering way and took me quite a while to figure out.
comment:16 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
This isn't a bug, so I'm closing it. Feel free to open a new ticket with a documentation patch if you like.
comment:18 by , 13 years ago
Easy pickings: | unset |
---|---|
Severity: | → Normal |
Type: | → Uncategorized |
UI/UX: | unset |
See #17550 for an annoying consequence of this fix.
Request META: