From e009777c6f67d86c504144b01bdd290357536418 Mon Sep 17 00:00:00 2001 From: helsonxiao Date: Sun, 8 May 2022 17:13:22 +0800 Subject: [PATCH] fix: rundramatiq --- deploy/supervisord.conf | 2 +- oj/dev_settings.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/deploy/supervisord.conf b/deploy/supervisord.conf index b1740466..4e590165 100644 --- a/deploy/supervisord.conf +++ b/deploy/supervisord.conf @@ -39,7 +39,7 @@ stopwaitsecs = 5 killasgroup=true [program:dramatiq] -command=python3 manage.py rundramatiq --no-reload --processes %(ENV_MAX_WORKER_NUM)s --threads 4 +command=python3 manage.py rundramatiq --processes %(ENV_MAX_WORKER_NUM)s --threads 4 directory=/app/ user=nobody stdout_logfile=/data/log/dramatiq.log diff --git a/oj/dev_settings.py b/oj/dev_settings.py index 4736c69f..f79cc876 100644 --- a/oj/dev_settings.py +++ b/oj/dev_settings.py @@ -1,22 +1,23 @@ # coding=utf-8 import os +from utils.shortcuts import get_env BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'HOST': '127.0.0.1', - 'PORT': 5435, - 'NAME': "onlinejudge", - 'USER': "onlinejudge", - 'PASSWORD': 'onlinejudge' + 'HOST': get_env('POSTGRES_HOST', '127.0.0.1'), + 'PORT': get_env('POSTGRES_PORT', '5435'), + 'NAME': get_env('POSTGRES_DB', 'onlinejudge'), + 'USER': get_env('POSTGRES_USER', 'onlinejudge'), + 'PASSWORD': get_env('POSTGRES_PASSWORD', 'onlinejudge') } } REDIS_CONF = { - "host": "127.0.0.1", - "port": "6380" + 'host': get_env('REDIS_HOST', '127.0.0.1'), + 'port': get_env('REDIS_PORT', '6380') }