I haveNginx + Gunicorn + Django
server deployed on Ubuntu. It running with Debug=False
settings and everything works fine. CSS
is loaded fine, JS
works as well. But when I try to update the css
file or js
file, the changes I made are not reflected when I run the server.
I tried to update an old static files, also static file created after collectstatic
command, I also tried clean collectstatic
as well as systemctl restart nginx (and gunicorn)
. I also cleaned my cache in browser. But when I look a page source code, these changes are not there.
this is how my nginx config
looks like
server {
listen 80;
server_name mediadbin.n-media.co.jp;
client_max_body_size 500M;
access_log /home/mediaroot/mediadbin/logs/nginx-access.log;
error_log /home/mediaroot/mediadbin/logs/nginx-error.log;
server_tokens off;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /static { $ I TRIED APPLY CHANGES HERE <- NOTHING happens
alias /home/mediaroot/mediadbin/mediadbin/static;
}
location /media {
alias /home/mediaroot/mediadbin/mediadbin/media;
}
include global404;
}
HERE is my gunicorn
config
#!/bin/bash
# Name of the application
NAME="mediadbin"
# Django project directory
DJANGODIR=/home/mediaroot/mediadbin/mediadbin
# how many worker processes should Gunicorn spawn
NUM_WORKERS= $(( $(nproc) * 2 + 1 ))
# which settings file should Django use
DJANGO_SETTINGS_MODULE=mediadbin.settings
# WSGI module name
DJANGO_WSGI_MODULE=mediadbin.wsgi
echo "Starting $NAME as `whoami`"
# Activate the virtual environment
cd $DJANGODIR
ENV=new_django
source /root/.virtualenvs/new_django/bin/activate
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
exec gunicorn ${DJANGO_WSGI_MODULE}:application \
--timeout 600
--name $NAME \
--workers &NUM_WORKERS \
--bind=127.0.0.1 \
--log-level=debug \
--log-file=-
>>> sudo find / -name menu_detail_look.js
/home/mediaroot/mediadbin/mediadbin/static/main_app/js/menu_detail_look.js
/home/mediaroot/mediadbin/mediadbin/main_app/static/main_app/js/menu_detail_look.js
↑ Updated both, nothing happens (no err in js also)