-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (21 loc) · 676 Bytes
/
app.py
File metadata and controls
32 lines (21 loc) · 676 Bytes
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
31
32
import os
from flask import Flask, jsonify, send_from_directory
from dotenv import load_dotenv
from routes.chat import chat_bp
from services.db import init_db
def create_app() -> Flask:
load_dotenv()
app = Flask(__name__, static_folder="static", static_url_path="/static")
app.register_blueprint(chat_bp)
init_db()
@app.get("/health")
def health_check():
return jsonify({"status": "ok"})
@app.get("/")
def index():
return send_from_directory(app.static_folder, "index.html")
return app
app = create_app()
if __name__ == "__main__":
port = int(os.getenv("PORT", "5000"))
app.run(host="0.0.0.0", port=port)