File size: 969 Bytes
9a46b15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""ContentForge — Flask app factory."""
import os
from flask import Flask
from flask_wtf.csrf import CSRFProtect

_csrf = CSRFProtect()


def create_app():
    app = Flask(__name__, template_folder="templates")
    app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "dev-contentforge-2026")
    app.config["MAX_CONTENT_LENGTH"] = 30 * 1024 * 1024
    _csrf.init_app(app)

    from app.home.routes import bp as home_bp
    app.register_blueprint(home_bp)

    from app.tools.content_repurposer.routes import bp as content_repurposer_bp
    app.register_blueprint(content_repurposer_bp, url_prefix='/content-repurposer')

    from app.tools.ai_debate_arena.routes import bp as ai_debate_arena_bp
    app.register_blueprint(ai_debate_arena_bp, url_prefix='/ai-debate-arena')

    from flask import jsonify
    @app.errorhandler(Exception)
    def _handle_exc(e):
        code = getattr(e, "code", 500)
        return jsonify({"error": str(e)}), code

    return app