Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 1 down vote accepted

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/*$ {
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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