Skip to content

Commit

Permalink
fix: async support
Browse files Browse the repository at this point in the history
feat: add workers arg for start
  • Loading branch information
robswc committed Feb 29, 2024
1 parent 0febb24 commit a164fc8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.3-alpine3.9
FROM python:3.11-alpine

COPY src /app
WORKDIR /app
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
volumes:
- ./src/components:/app/components
- ./src/settings.py:/app/settings.py
- ./src/.gui_key:/app/.gui_key
ports:
- "5000:5000"
network_mode: "host"
entrypoint: python3 tvwb.py
9 changes: 7 additions & 2 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ asgiref==3.7.2
blinker==1.6.2
click==8.1.3
colorama==0.4.6
Flask[async]==3.0.2
Flask==3.0.2
Flask[async]
gunicorn==20.1.0
importlib-metadata==6.6.0
iniconfig==2.0.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
packaging==23.2
pluggy==1.4.0
pytest==8.0.2
shellingham==1.4.0
typer==0.7.0
typer-cli==0.0.13
typing_extensions==4.5.0
Werkzeug==2.3.3
Werkzeug==3.0.1
zipp==3.15.0
6 changes: 5 additions & 1 deletion src/tvwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def start(
),
port: int = typer.Option(
default=5000
),
workers: int = typer.Option(
default=1,
help='Number of workers to run the server with.',
)
):
def clear_gui_key():
Expand Down Expand Up @@ -59,7 +63,7 @@ def print_gui_info():

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

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

0 comments on commit a164fc8

Please sign in to comment.