From ff19af60057aa5f2d67afe69ee6b6c197799b800 Mon Sep 17 00:00:00 2001 From: Anderson T Date: Thu, 14 Nov 2024 17:01:56 -0800 Subject: [PATCH] use production server to serve --- main.py | 9 ++++++++- requirements.txt | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 864f2b8..84e282d 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import sys from flask import Flask, redirect app = Flask(__name__) @@ -29,4 +30,10 @@ def redirect_link(path): if __name__ == '__main__': - app.run(debug=True) + + if "-dev" in sys.argv: + app.run(debug=True) + + else: + from waitress import serve + serve(app, host="0.0.0.0", port=5000, threads=20) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 772a612..c067ebd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ Flask==2.2.5 # Specify the version you want to use -Werkzeug==2.2.2 \ No newline at end of file +Werkzeug==2.2.2 +waitress \ No newline at end of file