I have written an application in Python/Flask which I need to deploy in production on a Windows Server(unfortunately). I came across a suggestion to use Waitress. It was a simple modification to make the web app use waitress, but my issues remain unsolved.
To server using waitress I have modified the code as below(just a basic example)
from flask import Flask
from waitress import serve
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == '__main__':
# app.run()
serve(app, host='0.0.0.0', port=8000)
Now I can run this from the command prompt via(same as without waitress)
python myapp.py
But I cannot use this in production.
- How do I make sure that the server keeps running in case someone closes the cmd prompt.
- How to make sure when the server is rebooted, the webapp comes up automatically without a user having to login and launch the app again.
If these two basic issues are not solvable then I wonder why waitress claims to be a production ready server :)