From 8c73579eae865797cb050721f4aef2d556739665 Mon Sep 17 00:00:00 2001 From: joizhang Date: Sat, 10 Dec 2022 21:33:33 +0800 Subject: [PATCH] feat: add gunicorn --- .gitignore | 3 ++- poetry.lock | 28 +++++++++++++++++++++++++++- pyproject.toml | 1 + wsgi.py | 5 +---- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index c697f55..9a4f0db 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,5 @@ temp/ *.sqlite *.zip -*.dat \ No newline at end of file +*.dat +nohup.out \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index c54c430..a5aa8fa 100644 --- a/poetry.lock +++ b/poetry.lock @@ -327,6 +327,28 @@ type = "legacy" url = "https://pypi.tuna.tsinghua.edu.cn/simple" reference = "tuna" +[[package]] +name = "gunicorn" +version = "20.1.0" +description = "WSGI HTTP Server for UNIX" +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +setuptools = ">=3.0" + +[package.extras] +eventlet = ["eventlet (>=0.24.1)"] +gevent = ["gevent (>=1.4.0)"] +setproctitle = ["setproctitle"] +tornado = ["tornado (>=0.2)"] + +[package.source] +type = "legacy" +url = "https://pypi.tuna.tsinghua.edu.cn/simple" +reference = "tuna" + [[package]] name = "idna" version = "3.4" @@ -1140,7 +1162,7 @@ reference = "tuna" [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "0ade2b3a0a9e049fee153ac50e5069399111f3238e04a16c5efed729f976f0dc" +content-hash = "ad85d625fa3ccf4f6aa7f78292164600e7b9d8f787320e8f76c0f3b2b4599ac2" [metadata.files] albumentations = [ @@ -1384,6 +1406,10 @@ greenlet = [ {file = "greenlet-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:b23d2a46d53210b498e5b701a1913697671988f4bf8e10f935433f6e7c332fb6"}, {file = "greenlet-2.0.1.tar.gz", hash = "sha256:42e602564460da0e8ee67cb6d7236363ee5e131aa15943b6670e44e5c2ed0f67"}, ] +gunicorn = [ + {file = "gunicorn-20.1.0-py3-none-any.whl", hash = "sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e"}, + {file = "gunicorn-20.1.0.tar.gz", hash = "sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8"}, +] idna = [ {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, diff --git a/pyproject.toml b/pyproject.toml index cedd362..e8c1584 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ timm = "0.4.12" facenet-pytorch = "^2.5.2" albumentations = "^1.3.0" opencv-python = "^4.6.0.66" +gunicorn = "^20.1.0" [tool.poetry.group.dev.dependencies] pytest = "^7.2.0" diff --git a/wsgi.py b/wsgi.py index f5b6a74..d663400 100644 --- a/wsgi.py +++ b/wsgi.py @@ -1,8 +1,5 @@ from app import create_app from config import ProductionConfig +# gunicorn -w 1 --worker-class=gevent -b 0.0.0.0:5000 --daemon wsgi:app app = create_app(ProductionConfig) - -if __name__ == '__main__': - # gunicorn -w 4 --worker-class=gevent -b 0.0.0.0:5000 --daemon wsgi:app - app.run() -- Gitee