diff --git a/apps/common/management/commands/services/hands.py b/apps/common/management/commands/services/hands.py index 2fada14c6..8c09a0a7d 100644 --- a/apps/common/management/commands/services/hands.py +++ b/apps/common/management/commands/services/hands.py @@ -2,7 +2,7 @@ import logging import os import sys -from maxkb.const import CONFIG, PROJECT_DIR +from maxkb.const import CONFIG, PROJECT_DIR, LOG_DIR try: from apps.maxkb import const @@ -19,7 +19,6 @@ HTTP_HOST = '0.0.0.0' HTTP_PORT = CONFIG.HTTP_LISTEN_PORT or 8080 DEBUG = CONFIG.DEBUG or False -LOG_DIR = os.path.join(PROJECT_DIR, 'data', 'logs') APPS_DIR = os.path.join(PROJECT_DIR, 'apps') TMP_DIR = os.path.join(PROJECT_DIR, 'tmp') if not os.path.exists(TMP_DIR): diff --git a/apps/maxkb/const.py b/apps/maxkb/const.py index 8e673580e..ffabf19bd 100644 --- a/apps/maxkb/const.py +++ b/apps/maxkb/const.py @@ -9,6 +9,7 @@ from .conf import ConfigManager __all__ = ['BASE_DIR', 'PROJECT_DIR', 'VERSION', 'CONFIG'] BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +LOG_DIR = os.path.join('/', 'opt', 'maxkb', 'logs') PROJECT_DIR = os.path.dirname(BASE_DIR) VERSION = '2.0.0' diff --git a/apps/maxkb/settings/lib.py b/apps/maxkb/settings/lib.py index be86d813e..bc9299f4e 100644 --- a/apps/maxkb/settings/lib.py +++ b/apps/maxkb/settings/lib.py @@ -9,7 +9,7 @@ import os import shutil -from maxkb.const import CONFIG, PROJECT_DIR +from maxkb.const import CONFIG, PROJECT_DIR, LOG_DIR # celery相关配置 celery_data_dir = os.path.join(PROJECT_DIR, 'data', 'celery_task') @@ -45,4 +45,4 @@ CELERY_ONCE = { 'settings': {'location': celery_once_path} } CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True -CELERY_LOG_DIR = os.path.join(PROJECT_DIR, 'logs', 'celery') +CELERY_LOG_DIR = os.path.join(LOG_DIR, 'celery') diff --git a/apps/maxkb/settings/logging.py b/apps/maxkb/settings/logging.py index 9c3df8c15..c5d783ec7 100644 --- a/apps/maxkb/settings/logging.py +++ b/apps/maxkb/settings/logging.py @@ -2,9 +2,8 @@ # import os -from ..const import PROJECT_DIR, CONFIG +from ..const import PROJECT_DIR, CONFIG, LOG_DIR -LOG_DIR = os.path.join(PROJECT_DIR, 'data', 'logs') MAX_KB_LOG_FILE = os.path.join(LOG_DIR, 'max_kb.log') DRF_EXCEPTION_LOG_FILE = os.path.join(LOG_DIR, 'drf_exception.log') UNEXPECTED_EXCEPTION_LOG_FILE = os.path.join(LOG_DIR, 'unexpected_exception.log')