Files
template/gunicorn.conf.py
2025-12-21 00:20:27 +08:00

40 lines
732 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Gunicorn配置文件
生产环境使用
"""
import multiprocessing
import os
# 服务器socket
bind = f"0.0.0.0:{os.environ.get('PORT', 5000)}"
backlog = 2048
# 工作进程
workers = multiprocessing.cpu_count() * 2 + 1
worker_class = 'sync'
worker_connections = 1000
timeout = 30
keepalive = 2
# 日志
accesslog = 'logs/gunicorn_access.log'
errorlog = 'logs/gunicorn_error.log'
loglevel = 'info'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
# 进程命名
proc_name = 'your_app'
# 服务器机制
daemon = False
pidfile = 'gunicorn.pid'
umask = 0
user = None
group = None
tmp_upload_dir = None
# SSL如果需要
# keyfile = '/path/to/keyfile'
# certfile = '/path/to/certfile'