fix: Korrigiere JSON-Datei-Ladefehler und füge Debug-Route hinzu
Co-authored-by: aider (ollama_chat/qwen3-coder:30b) <aider@aider.chat>
This commit is contained in:
parent
8a8c469742
commit
68800a49d1
1 changed files with 10 additions and 0 deletions
10
app.py
10
app.py
|
|
@ -99,11 +99,21 @@ def debug():
|
|||
"""Debug-Route zum Überprüfen der Lektionen und Konfiguration"""
|
||||
progress = Progress.query.first()
|
||||
|
||||
# Versuche, den Inhalt der JSON-Datei zu lesen
|
||||
json_content = "Datei nicht gefunden"
|
||||
try:
|
||||
if os.path.exists(DATA_PATH):
|
||||
with open(DATA_PATH, "r", encoding="utf-8") as f:
|
||||
json_content = f.read()
|
||||
except Exception as e:
|
||||
json_content = f"Fehler beim Lesen der Datei: {e}"
|
||||
|
||||
debug_info = {
|
||||
'lessons_loaded': len(lessons),
|
||||
'lessons_content': lessons,
|
||||
'data_path': DATA_PATH,
|
||||
'file_exists': os.path.exists(DATA_PATH),
|
||||
'file_content': json_content[:500] + '...' if len(json_content) > 500 else json_content,
|
||||
'current_progress': {
|
||||
'current_text_index': progress.current_text_index if progress else None,
|
||||
'current_position': progress.current_position if progress else None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue