From cf24fab53a98c4e32425c8cc2a0d08e8622c5289 Mon Sep 17 00:00:00 2001 From: erjemin Date: Wed, 22 Apr 2026 00:03:06 +0300 Subject: [PATCH] =?UTF-8?q?=20fix:=20=D0=BF=D1=80=D0=B5-=D1=80=D0=B5=D0=BD?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D1=8B?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D0=B4=D0=BE=D0=BB=D0=B6=D0=BD=D1=8B=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D0=B0=D0=B4=D0=B0=D1=82=D1=8C=20=D0=B2=20=D1=80?= =?UTF-8?q?=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oknardia/web/catalog_series.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/oknardia/web/catalog_series.py b/oknardia/web/catalog_series.py index 568debc..e7e314e 100644 --- a/oknardia/web/catalog_series.py +++ b/oknardia/web/catalog_series.py @@ -93,10 +93,17 @@ def catalog_seria_info( except (ObjectDoesNotExist, ValueError): return redirect("/catalog/") - # Если есть "облегченный" шаблон с частичным pre-render, используем его. - light_template = f"{PATH_FOR_SERIA_INFO_HTML_INCLUDE}{seria_id}_id.html" - light_template_w_path = f"{TEMPLATES[0]['DIRS'][0]}/{light_template}" - is_hard_template = not os.path.isfile(light_template_w_path) + # В DEV отключаем pre-render cache: всегда рендерим «тяжелый» шаблон напрямую, + # чтобы тестировать актуальную серверную логику, а не сохраненный html-файл. + if DEBUG: + light_template = "seria_info/all_seria_info_pre_light.html" + light_template_w_path = "" + is_hard_template = True + else: + # В PROD используем существующий pre-render include при наличии на диске. + light_template = f"{PATH_FOR_SERIA_INFO_HTML_INCLUDE}{seria_id}_id.html" + light_template_w_path = f"{TEMPLATES[0]['DIRS'][0]}/{light_template}" + is_hard_template = not os.path.isfile(light_template_w_path) to_template: dict[str, object] = {} # Получаем все уникальные проемы серии и сразу добавляем iQuantity=1 @@ -206,10 +213,11 @@ def catalog_seria_info( to_template.update(for_seria_nav) to_template.update(seria_info_year(seria_id)) to_template.update(seria_info_geo_code(seria_id)) - string_prerender = render_to_string("seria_info/all_seria_info_pre_light.html", to_template) - with open(light_template_w_path, "w", encoding="utf-8") as file: - file.write(string_prerender) - touch_reload_wsgi(light_template_w_path) + if not DEBUG: + string_prerender = render_to_string("seria_info/all_seria_info_pre_light.html", to_template) + with open(light_template_w_path, "w", encoding="utf-8") as file: + file.write(string_prerender) + touch_reload_wsgi(light_template_w_path) else: to_template.update({"THIS_SERIA_NAME": q_seria.sName})