Hello. I installed a nginx / uwsgi / flask bundle on a VPS / VDS (Ubuntu).
Works. I just noticed one annoying bug: in the Flask application, the index.html page is rendered with the help of render_template, if you change the document (index.html in my case), the changes will appear on the page after several reloads, but .. after subsequent reboots with a chance 50% shows old versions of the page (all versions saved in the editor, after reloading the systemctl restart web-site). After reboot

Example

bug

/ srv / web-site / application.py

from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): return render_template("index.html") if __name__ == "__main__": app.run() 

/ srv / web-site / uwsgi.ini

 [uwsgi] module = application:app master = true processes = 5 socket = /tmp/web-site.sock chmod-socket = 664 chown-socket = web-site:www-data uid = web-site gid = www-data logto = /var/log/uwsgi/%n.log vacuum = true die-on-term = true 

/ etc / systemd / system / web-site.service

 [Unit] Description=web-site server. After=network.target [Service] User=web-site Group=www-data WorkingDirectory=/srv/web-site Environment="PATH=/srv/web-site/venv/bin" ExecStart=/srv/web-site/venv/bin/uwsgi --ini uwsgi.ini [Install] WantedBy=multi-user.target 

/ etc / nginx / sites-avaible / web-site.conf

 server { listen 80; listen [::]:80 ipv6only=on; server_name web-site-ip; location / { include uwsgi_params; uwsgi_pass unix:/tmp/web-site.sock; } } 

After restarting the web-site.service service, previous versions stop showing. Tell me what could be the problem, what is the solution.
Thank you in advance.

  • Let me clarify: is your site running as a systemd web-site with uwsgi inside, and even if you restart it, is the old template still sometimes given? - andreymal
  • Yes. The site is launched as a systemd-service, but if it is restarted, it ceases to give up the old ones, relative to the moment of reboot. - Alexey
  • If everything is fine after the restart, then it seems like it should be, something flips something there caches - andreymal
  • Very strange, according to the ideas, a flake should send the newest version of the page, but not before last and not before last. - Alexey
  • 2
    Flask owes nothing to anybody, because templates are not taken to be changed while the server is running :) - andreymal

0