mirror of
https://github.com/YunoHost/tartiflette.git
synced 2024-09-03 20:06:08 +02:00
Fixing a few things for subpath deployment
This commit is contained in:
parent
6f3e6a0910
commit
34f31d00a4
5 changed files with 25 additions and 12 deletions
|
@ -5,7 +5,11 @@ db = SQLAlchemy()
|
||||||
|
|
||||||
def create_app():
|
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'
|
SQLALCHEMY_DATABASE_URI = 'sqlite:///./db.sqlite'
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
|
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
|
||||||
|
|
23
app/app.py
23
app/app.py
|
@ -1,8 +1,9 @@
|
||||||
from flask import Flask, render_template, jsonify
|
from flask import render_template, Blueprint
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
|
||||||
from .models import App, AppCI, AppCIBranch
|
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):
|
def sort_test_results(results):
|
||||||
|
|
||||||
|
@ -17,11 +18,17 @@ def sort_test_results(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():
|
def index():
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
@app.route('/appci/branch/<branch>')
|
|
||||||
|
@main.route('/appci/branch/<branch>')
|
||||||
def appci_branch(branch):
|
def appci_branch(branch):
|
||||||
|
|
||||||
branch = AppCIBranch.query.filter_by(name=branch).first_or_404()
|
branch = AppCIBranch.query.filter_by(name=branch).first_or_404()
|
||||||
|
@ -32,7 +39,8 @@ def appci_branch(branch):
|
||||||
branch=branch,
|
branch=branch,
|
||||||
app_results=app_results)
|
app_results=app_results)
|
||||||
|
|
||||||
@app.route('/appci/app/<app>')
|
|
||||||
|
@main.route('/appci/app/<app>')
|
||||||
def appci_app(app):
|
def appci_app(app):
|
||||||
|
|
||||||
app = App.query.filter_by(name=app).first_or_404()
|
app = App.query.filter_by(name=app).first_or_404()
|
||||||
|
@ -46,7 +54,8 @@ def appci_app(app):
|
||||||
app=app,
|
app=app,
|
||||||
branch_results=branch_results)
|
branch_results=branch_results)
|
||||||
|
|
||||||
@app.route('/appci/compare/<ref>...<target>')
|
|
||||||
|
@main.route('/appci/compare/<ref>...<target>')
|
||||||
def appci_compare(ref, target):
|
def appci_compare(ref, target):
|
||||||
|
|
||||||
assert ref != target, "Can't compare the same branches, bruh"
|
assert ref != target, "Can't compare the same branches, bruh"
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
{% for result in branch_results %}
|
{% for result in branch_results %}
|
||||||
<tr branch="{{ result.branch.name }}">
|
<tr branch="{{ result.branch.name }}">
|
||||||
<td class="ci-app-row-title">
|
<td class="ci-app-row-title">
|
||||||
<a href="{{ url_for('appci_branch', branch=result.branch.name) }}">
|
<a href="{{ url_for('main.appci_branch', branch=result.branch.name) }}">
|
||||||
<span title="Branch">
|
<span title="Branch">
|
||||||
<strong>{{ result.branch.display_name }}</strong></span>
|
<strong>{{ result.branch.display_name }}</strong></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
{% if result.app.list.name == "official" %}
|
{% if result.app.list.name == "official" %}
|
||||||
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
|
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ url_for('appci_app', app=result.app.name) }}">
|
<a href="{{ url_for('main.appci_app', app=result.app.name) }}">
|
||||||
<span title="App">
|
<span title="App">
|
||||||
<strong>{{ result.app.name }}</strong></span>
|
<strong>{{ result.app.name }}</strong></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
{% if result.app.list.name == "official" %}
|
{% if result.app.list.name == "official" %}
|
||||||
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
|
<span class="official-star oi oi-star" title="Official" aria-hidden="true"></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ url_for('appci_app', app=result.app.name) }}">
|
<a href="{{ url_for('main.appci_app', app=result.app.name) }}">
|
||||||
<span title="App">
|
<span title="App">
|
||||||
<strong>{{ result.app.name }}</strong></span>
|
<strong>{{ result.app.name }}</strong></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue