visualisation des corrections et api flask pour modifier le livre

This commit is contained in:
Tykayn 2025-08-30 22:41:51 +02:00 committed by tykayn
parent 0680c7594e
commit 7095f9633b
14 changed files with 1593 additions and 276 deletions

19
app.py
View file

@ -1,11 +1,21 @@
from flask import Flask, render_template, request, jsonify
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Application Flask pour le générateur de livre.
"""
from flask import Flask, render_template, request, jsonify, send_from_directory
import os
import json
from datetime import datetime, timedelta
import re
from api_corrections import corrections_api
app = Flask(__name__, static_folder='static')
# Enregistrer le blueprint de l'API de corrections
app.register_blueprint(corrections_api)
def load_org_file(filename):
if os.path.exists(filename):
with open(filename, 'r', encoding='utf-8') as f:
@ -355,5 +365,10 @@ def get_characters_file():
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/build/<path:path>')
def serve_build(path):
"""Sert les fichiers statiques du dossier build."""
return send_from_directory('build', path)
if __name__ == '__main__':
app.run(debug=True)
app.run(debug=True, host='0.0.0.0', port=5000)