Skip to content

Commit a164fc8

Browse files
committed
fix: async support
feat: add workers arg for start
1 parent 0febb24 commit a164fc8

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7.3-alpine3.9
1+
FROM python:3.11-alpine
22

33
COPY src /app
44
WORKDIR /app

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ services:
66
volumes:
77
- ./src/components:/app/components
88
- ./src/settings.py:/app/settings.py
9+
- ./src/.gui_key:/app/.gui_key
910
ports:
1011
- "5000:5000"
12+
network_mode: "host"
1113
entrypoint: python3 tvwb.py

src/requirements.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ asgiref==3.7.2
22
blinker==1.6.2
33
click==8.1.3
44
colorama==0.4.6
5-
Flask[async]==3.0.2
5+
Flask==3.0.2
6+
Flask[async]
67
gunicorn==20.1.0
78
importlib-metadata==6.6.0
9+
iniconfig==2.0.0
810
itsdangerous==2.1.2
911
Jinja2==3.1.2
1012
MarkupSafe==2.1.2
13+
packaging==23.2
14+
pluggy==1.4.0
15+
pytest==8.0.2
1116
shellingham==1.4.0
1217
typer==0.7.0
1318
typer-cli==0.0.13
1419
typing_extensions==4.5.0
15-
Werkzeug==2.3.3
20+
Werkzeug==3.0.1
1621
zipp==3.15.0

src/tvwb.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def start(
2727
),
2828
port: int = typer.Option(
2929
default=5000
30+
),
31+
workers: int = typer.Option(
32+
default=1,
33+
help='Number of workers to run the server with.',
3034
)
3135
):
3236
def clear_gui_key():
@@ -59,7 +63,7 @@ def print_gui_info():
5963

6064
def run_server():
6165
print("Close server with Ctrl+C in terminal.")
62-
run(f'gunicorn --bind {host}:{port} wsgi:app'.split(' '))
66+
run(f'gunicorn --bind {host}:{port} wsgi:app --workers {workers}'.split(' '))
6367

6468
# clear gui key if gui is set to open, else generate key
6569
# Flask uses the existence of the key file to determine GUI mode

0 commit comments

Comments
 (0)