-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
46 lines (35 loc) · 1.33 KB
/
app.py
File metadata and controls
46 lines (35 loc) · 1.33 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""SeaForge — the open-source life-at-sea platform."""
import os
from flask import Flask
from src.data.models import init_db
def create_app():
app = Flask(__name__, static_folder="static", template_folder="templates")
app.secret_key = os.environ.get("SEAFORGE_SECRET_KEY", "dev-key-change-me")
# Initialize database
with app.app_context():
init_db()
# Register API blueprints
from src.api.navigation import bp as nav_bp
from src.api.wellbeing import bp as wellbeing_bp
from src.api.training import bp as training_bp
from src.api.ops import bp as ops_bp
app.register_blueprint(nav_bp)
app.register_blueprint(wellbeing_bp)
app.register_blueprint(training_bp)
app.register_blueprint(ops_bp)
# Main page — serve the maritime intelligence dashboard
@app.route("/")
def index():
from flask import render_template
return render_template("index.html")
# Health check
@app.route("/api/health")
def health():
return {"status": "ok", "version": "0.1.0"}
return app
if __name__ == "__main__":
app = create_app()
host = os.environ.get("SEAFORGE_HOST", "0.0.0.0")
port = int(os.environ.get("SEAFORGE_PORT", 5000))
debug = os.environ.get("SEAFORGE_DEBUG", "false").lower() == "true"
app.run(host=host, port=port, debug=debug)