átlagos kiegészítséek jó sok
This commit is contained in:
38
backend/app/scripts/fix_imports_diag.py
Normal file
38
backend/app/scripts/fix_imports_diag.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# /opt/docker/dev/service_finder/backend/app/scripts/fix_imports_diag.py
|
||||
import os
|
||||
import re
|
||||
|
||||
# Az alapkönyvtár, ahol a kódjaid vannak
|
||||
BASE_DIR = "/app/app"
|
||||
|
||||
def check_imports():
|
||||
print("🔍 Importálási hibák keresése...")
|
||||
broken_count = 0
|
||||
|
||||
for root, dirs, files in os.walk(BASE_DIR):
|
||||
for file in files:
|
||||
if file.endswith(".py"):
|
||||
file_path = os.path.join(root, file)
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
# Keresünk minden 'from app.models...' kezdetű sort
|
||||
match = re.search(r'from app\.models\.(\w+)', line)
|
||||
if match:
|
||||
model_name = match.group(1)
|
||||
# Ellenőrizzük, hogy létezik-e ilyen fájl vagy mappa a models alatt
|
||||
# Figyelem: itt az új szerkezetet (marketplace, system, identity) kellene látnia
|
||||
target_path = os.path.join(BASE_DIR, "models", model_name)
|
||||
target_file = target_path + ".py"
|
||||
|
||||
if not os.path.exists(target_path) and not os.path.exists(target_file):
|
||||
print(f"❌ HIBA: {file_path} (sor: {i+1})")
|
||||
print(f" -> Importált: {match.group(0)}")
|
||||
print(f" -> Nem található itt: {target_file} vagy {target_path}")
|
||||
broken_count += 1
|
||||
|
||||
print(f"\n✅ Vizsgálat kész. Összesen {broken_count} törött importot találtam.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_imports()
|
||||
Reference in New Issue
Block a user