简体   繁体   English

如何在不重新启动uwsgi实例的情况下更新Flask模板?

[英]How can i update flask templates without restarting the uwsgi instance?

I have a flask application using an uwsgi instance. 我有一个使用uwsgi实例的flask应用程序。 This application runs some threads in background when a cron command starts. 当cron命令启动时,此应用程序在后台运行一些线程。 Is there a method for updating my template files without restarting the uwsgi service ? 是否有一种无需重启uwsgi服务即可更新模板文件的方法?

Currently I'm waiting for my threads to stop and then reloading the uwsgi service. 目前,我正在等待线程停止,然后重新加载uwsgi服务。

Enabling TEMPLATES_AUTO_RELOAD works nicely: 启用TEMPLATES_AUTO_RELOAD效果很好:

app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True

Whether to check for modifications of the template source and reload it automatically. 是否检查模板源的修改并自动重新加载。 By default the value is None which means that Flask checks original file only in debug mode. 默认情况下,该值为“无”,这意味着Flask仅在调试模式下检查原始文件。

Source: http://flask.pocoo.org/docs/0.12/config/ 资料来源: http : //flask.pocoo.org/docs/0.12/config/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让uwsgi接受没有数据的POST请求? - How can I get uwsgi to accept POST request without data? 如何更新在ubuntu上通过uWSGI和Nginx部署的flask API代码? - How do I update my flask API code deployed over uWSGI and Nginx on ubuntu? 在使用 uWSGI 运行 Flask 应用程序时,如何保护我的源代码? - How can I protect my source code when running a Flask application with uWSGI? 在使用uWSGI进行部署时,如何使用getpass向Flask应用程序提供输入? - How can I give input with getpass to a Flask app when deploying with uWSGI? 如何在 uwsgi 后面运行的烧瓶上启用保持活动状态? - How can I enable keep-alive on flask running behind uwsgi? 如何在不重新启动python解释器的情况下对模块进行更改? - How can I make a change to a module without restarting python interpreter? 如何在不缓存模板的情况下运行Flask? - How to run Flask without caching templates? 如何在 linux 服务器中更新我的 Web 应用程序功能? Web 应用程序是使用 Python、Flask、uwsgi 和服务器 nginx 构建的 - How do I update my web app features in the linux server? web app is build with Python, Flask, uwsgi and server nginx 使用flask + uwsgi + nginx将flask部署到服务器时,多进程无法在flask中工作 - Multiprocess can not work in flask when I deploy flask to server by using flask + uwsgi + nginx 如何在CentOs中运行uWsgi作为服务? - How can I run uWsgi as a service in CentOs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM