-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgunicorn.py
54 lines (41 loc) · 1.14 KB
/
gunicorn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: LiuZhi
@time: 2019-02-03 10:51
@contact: [email protected]
@software: PyCharm
about: https://github.com/benoitc/gunicorn/blob/master/examples/example_config.py
"""
import multiprocessing, datetime
bind = '0.0.0.0:5000'
backlog = 2048
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'gevent'
worker_connections = 1000
timeout = 60
keepalive = 2
# spew - Install a trace function that spews every line of Python
# that is executed when running the server. This is the
# nuclear option.
#
# True or False
spew = False
daemon = False
# raw_env = [
# 'DJANGO_SECRET_KEY=something',
# 'SPAM=eggs',
# ]
pidfile = None
umask = 0
user = None
group = None
tmp_upload_dir = None
# 日志配置
# A string of "debug", "info", "warning", "error", "critical"
loglevel = 'debug'
now_time = datetime.datetime.now().strftime("%Y-%m-%d")
app_name = 'falsk_app'
accesslog = f'./logs/gunicorn/{app_name}-acess-{now_time}.log'
errorlog = f'./logs/gunicorn/{app_name}-error-{now_time}.log'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'