From fac19ea38fbd46bf6d6636e9d12b555269788019 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 7 Jun 2023 15:07:45 +0200 Subject: ⚡️ improve post treatments after imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - check_cascade_update is now function which evaluate if cascade update is relevant - "_no_repost_save" attribute prevent a resave after post import - fix updat check for geo post save - add some logging --- example_project/settings.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'example_project/settings.py') diff --git a/example_project/settings.py b/example_project/settings.py index d6bc19bcd..95abc793e 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -204,7 +204,8 @@ AXES_RESET_ON_SUCCESS = True MAIN_APP = "" -LOGFILE = "" +LOG_FILE = "" +LOG_LEVEL = "" default_handler = {"handlers": ["logfile"], "level": "INFO", "propogate": False} @@ -378,8 +379,8 @@ TESTING = sys.argv[1:2] == ["test"] PROJECT_SLUG = locals().get("PROJECT_SLUG", "default") -if LOGFILE: - LOGGING["handlers"]["logfile"]["filename"] = LOGFILE +if LOG_FILE: + LOGGING["handlers"]["logfile"]["filename"] = LOG_FILE elif DEBUG: LOGGING["handlers"]["logfile"]["filename"] = ( ROOT_PATH + "log-" + PROJECT_SLUG + ".log" @@ -394,7 +395,7 @@ INTERNAL_IPS = ("127.0.0.1",) JQUERY_URL = STATIC_URL + "js/jquery.min.js" JQUERY_UI_URL = STATIC_URL + "js/jquery-ui/" -if DEBUG: +if DEBUG and not LOG_FILE: # make all loggers use the console for logger in LOGGING["loggers"]: if DEBUG_TO_CONSOLE: @@ -402,6 +403,12 @@ if DEBUG: elif "console" not in LOGGING["loggers"][logger]["handlers"]: LOGGING["loggers"][logger]["handlers"] += ["console"] +if LOG_LEVEL: + for logger in LOGGING["loggers"]: + LOGGING["loggers"][logger]["level"] = LOG_LEVEL + if logger.startswith("archaeological") or logger.startswith("ishtar"): + LOGGING["loggers"][logger]["level"] = LOG_LEVEL + if USE_BACKGROUND_TASK: if not CELERY_BROKER_URL: CELERY_BROKER_URL = "amqp://localhost" -- cgit v1.2.3