Skip to content

Commit 10dc73c

Browse files
committed
app.py: redirect to home instead of rendering index.html separately after submitting build form
1 parent 0f139ed commit 10dc73c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import hashlib
1212
import fnmatch
1313
from distutils.dir_util import copy_tree
14-
from flask import Flask, render_template, request, send_from_directory, render_template_string, jsonify
14+
from flask import Flask, render_template, request, send_from_directory, render_template_string, jsonify, redirect
1515
from threading import Thread, Lock
1616
import sys
1717
import re
@@ -640,8 +640,8 @@ def generate():
640640

641641
base_url = request.url_root
642642
app.logger.info(base_url)
643-
app.logger.info('Rendering index.html')
644-
return render_template('index.html', token=token)
643+
app.logger.info('Redirecting to /')
644+
return redirect('/'+token)
645645

646646
except Exception as ex:
647647
app.logger.error(ex)
@@ -668,11 +668,13 @@ def filter_build_options_by_category(build_options, category):
668668
def parse_build_categories(build_options):
669669
return sorted(list(set([f.category for f in build_options])))
670670

671-
@app.route('/')
672-
def home():
671+
@app.route('/', defaults={'token': None}, methods=['GET'])
672+
@app.route('/<token>', methods=['GET'])
673+
def home(token):
674+
if token:
675+
app.logger.info("Showing log for build id " + token)
673676
app.logger.info('Rendering index.html')
674-
return render_template('index.html',
675-
token=None)
677+
return render_template('index.html', token=token)
676678

677679
@app.route("/builds/<path:name>")
678680
def download_file(name):

0 commit comments

Comments
 (0)