Nginx fastcgi problems with django
Posted
by wizard
on Server Fault
See other posts from Server Fault
or by wizard
Published on 2010-04-22T13:31:53Z
Indexed on
2010/04/22
13:33 UTC
Read the original article
Hit count: 271
I'm deploying my first django app. I'm familiar with nginx and fastcgi from deploying php-fpm. I can't get python to recognize the urls. I'm also at a loss on how to debug this further. I'd welcome solutions to this problem and tips on debugging fastcgi problems.
Currently I get a 404 page regardless of the url and for some reason a double slash For http://www.site.com/admin/
Page not found (404)
Request Method: GET
Request URL: http://www.site.com/admin//
My urls.py from the debug output - which work in the dev server.
Using the URLconf defined in ahrlty.urls, Django tried these URL patterns, in this order:
^listings/
^admin/
^accounts/login/$
^accounts/logout/$
my nginx config
server {
listen 80;
server_name beta.ahrlty.com;
access_log /home/ahrlty/ahrlty/logs/access.log;
error_log /home/ahrlty/ahrlty/logs/error.log;
location /static/ {
alias /home/ahrlty/ahrlty/ahrlty/static/;
break;
}
location /media/ {
alias /usr/lib/python2.6/dist-packages/django/contrib/admin/media/;
break;
}
location / {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:8001;
break;
}
}
and my fastcgi_params
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 SCRIPT_NAME $fastcgi_script_name;
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;
fastcgi_param PATH_INFO $fastcgi_script_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
And lastly I'm running fastcgi from the commandline with django's manage.py.
python manage.py runfcgi method=threaded host=127.0.0.1 port=8080 pidfile=mysite.pid minspare=4 maxspare=30 daemonize=false
I'm having a hard time debugging this one. Does anything jump out at anybody?
© Server Fault or respective owner