2

I am trying to serve Django admin static files but nothing seems to be working below is my nginx configuration :

upstream django {
    server 127.0.0.1:8000;
    }

server {

    listen      4321;
    server_name localhost;
    charset     utf-8;
    access_log /var/log/nginx/local-access.log;
    error_log /var/log/nginx/local-error.log;
    client_max_body_size 75M;
    include /etc/nginx/mime.types;

location /static/  {
alias /home/vaibhav/TRAC/bright-coupons/brightCoupons/brightCouponsApp/static/;
}

    location / {
    uwsgi_pass  django;
    include     /etc/nginx/uwsgi_params;
    }

    }

I didn't understand my templates are working fine but not Django admin panel ...I have used python manage.py collectstatic command and now all Django static files are inside my static folder of app.

Nginx access-logs:

127.0.0.1 - - [14/May/2013:16:44:24 +0530] "GET /bcadmin/brightCouponsApp/static/admin/css/base.css HTTP/1.1" 500 5 "http://localhost:4321/bcadmin/" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31"

uWSGI logs:

[pid: 10689|app: 0|req: 1/3] 127.0.0.1 () {46 vars in 895 bytes} [Tue May 14 16:44:24 2013] GET /bcadmin/brightCouponsApp/static/admin/css/login.css => generated 0 bytes in 30522 msecs (HTTP/1.1 500) 

The nginx error logs are empty....

1

You need to either set the root:

root /home/vaibhav/TRAC/bright-coupons/brightCoupons/brightCouponsApp;

Or set the location to match any /static/ in the uri:

location ~* ^/static/*$ {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.