From 09e684a07c7eb397f91afd66dd97ca80ceefc512 Mon Sep 17 00:00:00 2001 From: Karl Determe Date: Tue, 25 Aug 2026 12:23:46 +0200 Subject: [PATCH] Ensure cross_plans directory exists before saving JSON in import_cross_plan --- loko/assets/views/trafficlights.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loko/assets/views/trafficlights.py b/loko/assets/views/trafficlights.py index 2cb9d7a..8f7d958 100644 --- a/loko/assets/views/trafficlights.py +++ b/loko/assets/views/trafficlights.py @@ -3706,6 +3706,7 @@ def import_cross_plan(request, intersection_id): intersection = get_object_or_404(TrafficLightIntersection, pk=intersection_id) uploaded_dir = os.path.join(settings.PRIVATE_MEDIA_ROOT, 'cross_plans') + os.makedirs(uploaded_dir, exist_ok=True) # Fetch DXF files and georeferenced documents associated with this intersection dxf_files = [] @@ -4030,6 +4031,7 @@ def import_cross_plan(request, intersection_id): # Save merged results into a temporary JSON file json_filename = f"combined_{intersection.id}_{uuid.uuid4().hex}.json" json_filepath = os.path.join(uploaded_dir, json_filename) + os.makedirs(uploaded_dir, exist_ok=True) with open(json_filepath, 'w', encoding='utf-8') as f: json.dump(merged_deduced, f, indent=4)