diff --git a/app/__init__.py b/app/__init__.py index 5b256c3..2f38666 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -5,7 +5,11 @@ db = SQLAlchemy() def create_app(): - from .app import app + from .app import main + from .settings import STATIC_ROOT + + app = Flask(__name__, static_url_path=STATIC_ROOT) + app.register_blueprint(main) SQLALCHEMY_DATABASE_URI = 'sqlite:///./db.sqlite' app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI diff --git a/app/app.py b/app/app.py index c23b636..6a708dd 100644 --- a/app/app.py +++ b/app/app.py @@ -1,8 +1,9 @@ -from flask import Flask, render_template, jsonify -from flask_sqlalchemy import SQLAlchemy +from flask import render_template, Blueprint from .models import App, AppCI, AppCIBranch +from .settings import SITE_ROOT + +main = Blueprint('main', __name__, url_prefix=SITE_ROOT) -app = Flask(__name__) def sort_test_results(results): @@ -14,14 +15,20 @@ def sort_test_results(results): print(results) return sorted(results, - key=lambda r: (-r.level, -r.score(), r.app.name)) + key=lambda r: (-r.level, -r.score(), r.app.name)) -@app.route('/') +@main.route('/tartiflette') +@main.route('/tartiflette/') +def woopsies(): + return "Woopsies" + +@main.route('/') def index(): return render_template('index.html') -@app.route('/appci/branch/') + +@main.route('/appci/branch/') def appci_branch(branch): branch = AppCIBranch.query.filter_by(name=branch).first_or_404() @@ -32,7 +39,8 @@ def appci_branch(branch): branch=branch, app_results=app_results) -@app.route('/appci/app/') + +@main.route('/appci/app/') def appci_app(app): app = App.query.filter_by(name=app).first_or_404() @@ -46,7 +54,8 @@ def appci_app(app): app=app, branch_results=branch_results) -@app.route('/appci/compare/...') + +@main.route('/appci/compare/...') def appci_compare(ref, target): assert ref != target, "Can't compare the same branches, bruh" diff --git a/app/templates/appci_app.html b/app/templates/appci_app.html index 4494acb..d5d7b25 100644 --- a/app/templates/appci_app.html +++ b/app/templates/appci_app.html @@ -21,7 +21,7 @@ {% for result in branch_results %} - + {{ result.branch.display_name }} diff --git a/app/templates/appci_branch.html b/app/templates/appci_branch.html index bff76a5..dba4a02 100644 --- a/app/templates/appci_branch.html +++ b/app/templates/appci_branch.html @@ -25,7 +25,7 @@ {% if result.app.list.name == "official" %} {% endif %} - + {{ result.app.name }} diff --git a/app/templates/appci_compare.html b/app/templates/appci_compare.html index e9f9ddc..bd31c1d 100644 --- a/app/templates/appci_compare.html +++ b/app/templates/appci_compare.html @@ -22,7 +22,7 @@ {% if result.app.list.name == "official" %} {% endif %} - + {{ result.app.name }}