From 27ed99ee2714ae6415701de98682307f0dd24b9c Mon Sep 17 00:00:00 2001 From: mkg <1650473152@qq.com> Date: Thu, 28 Oct 2021 10:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0gunicorn=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gunicorn.conf.py | 19 +++++++++++++++++++ start.sh | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 gunicorn.conf.py create mode 100644 start.sh diff --git a/gunicorn.conf.py b/gunicorn.conf.py new file mode 100644 index 0000000..4aa61bf --- /dev/null +++ b/gunicorn.conf.py @@ -0,0 +1,19 @@ +import os +import multiprocessing + +bind = '0.0.0.0:8000' +backlog = 512 +chdir = os.path.dirname(os.path.abspath(__file__)) +timeout = 30 +worker_class = 'sync' + +workers = multiprocessing.cpu_count() * 2 + 1 +threads = 2 +loglevel = 'info' +access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"' + +if not os.path.exists('logs'): + os.mkdir('logs') + +accesslog = os.path.join(chdir, "logs/gunicorn_access.log") +errorlog = os.path.join(chdir, "logs/gunicorn_error.log") diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..faecf80 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +source venv/bin/activate +exec gunicorn -c gunicorn.conf.py "applications:create_app('development')" \ No newline at end of file