-2

i just deployed my first flask app and it was amazing, but i'm facing a problem i can't understand.

when i was developing my app (Window) i used set FLASK_ENV=development to see the changes in my app without restarting the flask server, when i uploaded the app to my vps worked great, but, when i tried to upload a new changes the app doesn't update.

Can someone explain me why my flask app code doesn't update when i upload it to my vps?

i'm using Gunicorn and i have already put the debug to true

if __name__ == '__main__':
    app.run(debug=True)

But when i visit my site i can't see the changes made just the first code i uploaded when i set the server.

What should i do to update my code once uploaded?

Edwin Munguia
  • 93
  • 2
  • 7
  • restart server. Gunicorn doesn't use code in `if __name__ == '__main__'` but it imports `app` and runs `app.run()` on its own. – furas Oct 12 '19 at 00:23
  • I've had issues where my IDE (visual studio) wasn't updating my code changes. My fix was to first restart the server and if that didn't work restart my IDE running the code. – mindless-overflow Oct 12 '19 at 00:24
  • to set debug you would have to use rather `app.debug = True` directly after `app = Flask(...)` or eventually set `FLASK_DEBUG=1` in environment - [How to debug a Flask app](https://stackoverflow.com/questions/17309889/how-to-debug-a-flask-app) – furas Oct 12 '19 at 00:28
  • [Debugging a Flask app running in Gunicorn](https://stackoverflow.com/questions/8950674/debugging-a-flask-app-running-in-gunicorn) – furas Oct 12 '19 at 00:30

1 Answers1

-1

If someone is interested in this problem, i've solved it by using:

sudo supervisorctl stop app_name
sudo supervisorctl start app_name

(yeah! i forgot to mention i'm using supervisor to handle the autostart.)

Edwin Munguia
  • 93
  • 2
  • 7