Skip to content

Commit

Permalink
Gunicorn port
Browse files Browse the repository at this point in the history
  • Loading branch information
camcam1773 committed Jul 21, 2024
1 parent 71877e6 commit 1b912f6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM python:3.10-alpine

ADD app.py /
ADD wsgi.py /
ADD requirements.txt /
ADD ./templates /templates/
ADD ./tests tests/
Expand All @@ -9,4 +10,4 @@ RUN pip install --upgrade pip
RUN pip install -r requirements.txt

EXPOSE 8080
CMD [ "python", "./app.py" ]
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--access-logfile", "-", "--workers", "3", "wsgi:app"]
6 changes: 1 addition & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,5 @@ def update(_id):


if __name__ == "__main__":
import logging
from waitress import serve
logging.getLogger('waitress').setLevel(logging.INFO)
logging.getLogger('werkzeug').setLevel(logging.INFO)
table = mongo.db.flask_crud
serve(app, host='0.0.0.0', port=8080)
app.run(host="127.0.0.1", port=8080)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flask==2.3.2
flask-sqlalchemy==3.0.3
flask-pymongo==2.3.0
waitress==2.1.2
gunicorn==22.0.0
flake8
pytest
6 changes: 6 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from app import app, mongo

table = mongo.db.flask_crud

if __name__ == "__main__":
app.run()

0 comments on commit 1b912f6

Please sign in to comment.