Skip to content

Commit

Permalink
swap out waitress for hypercorn
Browse files Browse the repository at this point in the history
  • Loading branch information
ilude committed Mar 25, 2024
1 parent dc8493d commit f97c58b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ ARG TZ=America/New_York
ENV USER=${USER}
ENV TZ=${TZ}

ARG PROJECT_NAME
ENV PROJECT_NAME=${PROJECT_NAME}

ARG PROJECT_PATH=/app
ENV PROJECT_PATH=${PROJECT_PATH}

ENV PYTHON_DEPS_PATH=/dependencies
ENV PYTHONPATH="${PYTHONPATH}:${PYTHON_DEPS_PATH}"
ENV PYTHONUNBUFFERED=TRUE

ENV LANGUAGE=en_US.UTF-8
ENV LANG=en_US.UTF-8
Expand Down Expand Up @@ -156,9 +161,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN echo ${USER} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USER} && \
chmod 0440 /etc/sudoers.d/${USER}

ARG PROJECT_NAME
ENV PROJECT_NAME=${PROJECT_NAME}

ENV DOTFILES_URL=https://github.com/ilude/dotfiles.git

USER ${USER}
Expand Down
8 changes: 6 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ def index():
if os.environ.get("FLASK_DEBUG", "False") == "True":
app.run(port=port, debug=True)
else:
from waitress import serve
serve(app, host='0.0.0.0', port=port)
import asyncio
from hypercorn.config import Config
from hypercorn.asyncio import serve
config = Config()
config.bind = [f"0.0.0.0:{port}"]
asyncio.run(serve(app, config))
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ flask
requests
selenium
pillow
waitress
hypercorn

0 comments on commit f97c58b

Please sign in to comment.