서버 배포 설정: wsgi.py, gunicorn, start.sh
This commit is contained in:
4
app.py
4
app.py
@@ -960,6 +960,8 @@ def index():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--host', default='127.0.0.1', help='Host to bind to')
|
||||||
parser.add_argument('--port', type=int, default=5000, help='Port to run the server on')
|
parser.add_argument('--port', type=int, default=5000, help='Port to run the server on')
|
||||||
|
parser.add_argument('--debug', action='store_true', help='Enable debug mode')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
app.run(debug=True, port=args.port)
|
app.run(host=args.host, debug=args.debug, port=args.port)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
Flask==3.1.1
|
Flask==3.1.1
|
||||||
openpyxl==3.1.5
|
openpyxl==3.1.5
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
|
gunicorn==26.0.0
|
||||||
|
|||||||
5
start.sh
Executable file
5
start.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
[ -d venv ] && . venv/bin/activate
|
||||||
|
exec gunicorn wsgi:app --bind 0.0.0.0:5000 --workers 4 --timeout 120
|
||||||
Reference in New Issue
Block a user