简体   繁体   中英

flask app not applying code changes to server with uwsgi and supervisor

I have a flask application running with uwsgi,nginx,and supervisor. No matter what I try I cant seem to get the code changes to take effect on the server.

If I run the app locally the changes are there. If I stop and start uwsgi, the changes take effect. If I restart the supervisor service the changes don't take effect.

I know the code has the changes because I log in and see the changes that I made but its still running the old code at specific routes. If I change the title of my page those changes take effect right away but for my webhook end points, they never seem to change.

Here are my config files.

app.ini
[uwsgi]
module = wsgi

master = true
processes = 5

socket = app.sock
chmod-socket = 660
vacuum = true

die-on-term = true

supervisor
[program:app.io]

command=/home/www/beta/v_env/bin/uwsgi --ini /home/www/beta/app.ini --chown-socket www-data:www-data

directory=/home/www/beta

autostart=true

autorestart=true

stdout_logfile=/home/logs/app_uwsgi.log

redirect=true

stopsignal=QUIT


nginx

server {
listen 80;
server_name beta.domain.io;

location / {
include uwsgi_params;
uwsgi_pass unix:/home/www/beta/app.sock;
uwsgi_read_timeout 1800;
}
}

When testing it I also get this error a lot upstream prematurely closed connection while reading response header from upstream

If your changes to the code aren't reflected in your program's behavior, then your code either hasn't been reloaded, or it hasn't changed, or you misunderstand your changes. The most common time this happens to me is when .pyc files fail to get refreshed. You might try clearing all the pyc files from your project then launching it again, assuming you have any pyc files. This will also have the benefit of restarting the application.

Before doing anything I recommend using supervisor to restart your application. If your application is within supervisor, you can use the following relevant methods:

supervisorctl stop all

supervisorctl start all

supervisorctl restart all

Edit: I forgot to mention that if you are viewing this in a browser then it is conceivable the browser is caching the older version. If this is the case, you would need to do a hard refresh.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM