fix: Behandle Escape-Zeichen korrekt beim Laden der lessons.json
Co-authored-by: aider (ollama_chat/qwen3-coder:30b) <aider@aider.chat>
This commit is contained in:
parent
bf5f409485
commit
70e3155636
1 changed files with 5 additions and 2 deletions
7
app.py
7
app.py
|
|
@ -8,10 +8,13 @@ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///typewriter.db'
|
|||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
db.init_app(app)
|
||||
|
||||
# Laden der Lektionen aus der JSON-Datei
|
||||
# Laden der Lektionen aus der JSON-Datei mit Escape-Zeichen-Handling
|
||||
DATA_PATH = os.path.join(app.root_path, "data", "lessons.json")
|
||||
with open(DATA_PATH, "r", encoding="utf-8") as f:
|
||||
lessons = json.load(f)
|
||||
data = f.read()
|
||||
# Alle einfachen Backslashes verdoppeln
|
||||
data = data.replace("\\", "\\\\")
|
||||
lessons = json.loads(data)
|
||||
|
||||
@app.before_request
|
||||
def create_tables():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue