# gunicorn_config.py | |
import os | |
worker_id_counter = 0 | |
def pre_fork(server, worker): | |
global worker_id_counter | |
worker_id_counter += 1 | |
def post_fork(server, worker): | |
worker_id = worker_id_counter - 1 | |
os.environ['WORKER_ID'] = str(worker_id % 4) |
# gunicorn_config.py | |
import os | |
worker_id_counter = 0 | |
def pre_fork(server, worker): | |
global worker_id_counter | |
worker_id_counter += 1 | |
def post_fork(server, worker): | |
worker_id = worker_id_counter - 1 | |
os.environ['WORKER_ID'] = str(worker_id % 4) |