1

I have a Flask App that I am running locally and testing. Every time, I make a change in the Application code, the changes would reflect on the dev environment http://127.0.0.1:8000/ with a simple browser refresh.

Now, I have to terminate the Flask App Ctrl X + Ctrl C and then reboot / relaunch the App. I am using gunicorn to launch the Flask App.

Not sure what changed, but how do I configure the App such that the changes take effect on refresh?

I have the following line of code in init.py:

if __name__ == '__main__':
    run_simple('0.0.0.0', 80, app, use_reloader=True, use_debugger=True)
kms
  • 1,810
  • 1
  • 41
  • 92

2 Answers2

10

Gunicorn has its own system to reload the worker process when the application code changes. You can use the --reload CLI flag to activate the auto-reloading dev mode.

gunicorn --reload app:app

You can add additional files to the watcher via the --reload-extra-file FILES arg.

Dauros
  • 9,294
  • 2
  • 20
  • 28
0

Try

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

Also using Gunicorn

web: gunicorn wsgi:app