Every time I update my Python file, I have to reboot the server to see changes. I have tried restarting Nginx and uWSGI with no luck. Flask is running in debug mode. How can I see changes without rebooting the entire server?
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;
}
}
I am testing this with these steps:
So, one way I got around this was to do this in my uwsgi.ini file
touch-reload = /home/vagrant/PythonVision/app.py
Then I touch the file app.py and BANG sorted
To actually run your flask app in debug mode, you run this command:
python /home/vagrant/PythonVision/app.py
Then you can go on your browser: http://ip:5000/.
Since I know you're running this on vagrant, the ip
might be defined by your configs, but that's beyond the scope of this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With