I'm trying update a web project which based on the nginx+Flask+uwsgi. And when I updated any python files, I found nginx was still using the old ones. When I removed all *.pyc files, no new pyc file was generated by python interpreter. It looks like there is a cache, I followed the answer of this question to try to clear the cache of nginx. But it didn't work.
Does anybody know any solution to let nginx to interpret python from new source file?
This is the nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile off;
#tcp_nopush on;
#tcp_nodelay on;
keepalive_timeout 65;
#types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name m.xxxx.com.cn;
location / {
include uwsgi_params;
uwsgi_pass unix:/root/003_exampleproject/exampleproject.sock;
}
}
And this is another config files:
(venv) [root@VM_0_3_centos 003_exampleproject]# cat /etc/systemd/system/exampleproject.service
[Unit]
Description=uWSGI instance to serve exampleproject
After=network.target
[Service]
User=root
Group=nginx
WorkingDirectory=/root/003_exampleproject/
Environment="PATH=/root/003_exampleproject/venv"
ExecStart=/root/003_exampleproject/venv/bin/uwsgi --ini exampleproject.ini --logto /var/log/uwsgi/exampleproject.log
[Install]
WantedBy=multi-user.target
(venv) [root@VM_0_3_centos 003_exampleproject]# cat exampleproject.ini
[uwsgi]
module = manage:app
master = true
processes = 5
socket = exampleproject.sock
chmod-socket = 660
vacuum = true
die-on-term = true
env = MBUS_ADMIN=root@example.com