from flask import Flask app = Flask(__name__) # app.run(host='0.0.0.0', port=8080,debug=True)
from waitress import serve import x1 serve(x1.app, host='0.0.0.0', port=8080)
Then run below command. You must create a virtual environment first!
ie. source venv/bin/activate
Serving on http://0.0.0.0:8080
Waitress now provides a simple command line Utility called waitress-serve for running the Flask Application. Please note that this answer is valid for Waitress 1.30. The command line arguments could change in future. If your Flask application is called x2 and the method which instantiates your application is called create_app, then you can simply use:-
waitress-serve --call "x2:create_app" - Cannot!
waitress-serve --port=8041 --url-scheme=https x2:wsgifunc
This command will launch the server listening on port 8080 by default. If you wish to launch it on port 80 (http), then all you need to do is:
waitress-serve –port=80 –call “x2:create_app”