每次更新Python文件时,都必须重新启动服务器才能看到更改.我尝试过重启Nginx和uWSGI,但是没有运气. Flask在调试模式下运行.如何在不重新启动整个服务器的情况下看到更改?
app.py
from flask import Flask
import time
import cv2
app = Flask(__name__)
@app.route("/")
def main():
return "Hello cob at " + time.time().__str__() + "\n"
if __name__ == "__main__":
app.run(debug=True)
uwsgi.ini
[uwsgi]
socket = :9090
plugin = python
wsgi-file = /home/vagrant/PythonVision/app.py
process = 3
callable = app
Nginx.conf
server {
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
}
}
我正在通过以下步骤对此进行测试:
>将返回消息从“ Hello cob”更改为“ hello bob”,保存文件
>在浏览器中刷新页面(清除浏览器缓存)不变
>重启sudo服务uwsgi,重启sudo服务Nginx
>在浏览器中刷新页面(清除浏览器缓存)不变