53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
"""
|
|
Bettersight Intelligence marketing site — lightweight standalone backend.
|
|
Deliberately separate from apps/bi/backend (the main product's Flask app):
|
|
this website is its own deployment (its own Dockerfile/compose, one level
|
|
up), so it gets its own tiny API instead of depending on the main app's
|
|
backend for anything. Two responsibilities only:
|
|
1. The homepage's "Request a demo" contact form (routes/contact.py)
|
|
2. The self-assess calculator's two flows — email-me-a-copy and the
|
|
inline "let's talk" contact form (routes/calculator.py):
|
|
PDF generation + email, per CLAUDE_CALCULATOR.md. The calculator's
|
|
own weighted-rate business logic stays entirely client-side; this
|
|
backend only ever renders whatever results/labels the frontend
|
|
already computed and emails them — it never recomputes or
|
|
duplicates that math.
|
|
|
|
No CORS setup here on purpose: nginx reverse-proxies /api/* on the site's
|
|
own origin to this Flask app (see ../nginx.conf) rather than the browser
|
|
calling this process on a different origin directly — there's no
|
|
cross-origin request to configure, and the Python source here is never
|
|
served as a static file the frontend (or a visitor's browser) can see.
|
|
|
|
Data flow:
|
|
create_app() called by gunicorn → blueprints registered → rate limiter
|
|
attached → app returned
|
|
"""
|
|
|
|
from flask import Flask, jsonify
|
|
|
|
from config import Config
|
|
from middleware.rate_limit import limiter
|
|
from routes.calculator import calculator_bp
|
|
from routes.contact import contact_bp
|
|
|
|
|
|
def create_app() -> Flask:
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
|
|
limiter.init_app(app)
|
|
|
|
app.register_blueprint(contact_bp)
|
|
app.register_blueprint(calculator_bp)
|
|
|
|
@app.route("/health")
|
|
def health():
|
|
return jsonify({"status": "ok"})
|
|
|
|
return app
|
|
|
|
|
|
if __name__ == "__main__":
|
|
create_app().run(host="0.0.0.0", port=5000, debug=False)
|