Files
devops/app.py
gitea 0c5eaa19cd
Some checks failed
Build and Deploy Demo App / test (push) Successful in 11s
Build and Deploy Demo App / build (push) Successful in 15s
Build and Deploy Demo App / deploy (push) Failing after 2m14s
Build and Deploy Demo App / scan (push) Successful in 19s
removed features.seed-db
2025-11-26 13:58:30 +03:30

21 lines
663 B
Python

import os
from flask import Flask, render_template
from flask_bootstrap import Bootstrap5
from models import db, Feature
app = Flask(__name__)
db_user = os.getenv('DB_USER')
db_pass = os.getenv('DB_PASS')
db_name = os.getenv('DB_NAME')
app.config['SQLALCHEMY_DATABASE_URI'] = f'postgresql://{db_user}:{db_pass}@db:5432/{db_name}' if db_user else 'sqlite:///:memory:' # Fallback only if no env (for tests)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
bootstrap = Bootstrap5(app)
db.init_app(app)
@app.route('/')
def index():
with app.app_context():
features = Feature.query.all()
return render_template('index.html', features=features)