def home(filename=None):
context = dict(
bower=full_url_for('home') + 'bower_components',
node_modules=full_url_for('home') + 'node_modules',
project_names=[proj for proj in crasher.projects],
type_names=[t for t in crasher.types],
thresholds=[str(thresh) for thresh in crasher.thresholds],
basehref=full_url_for('home'),
restbase=full_url_for('root'),
default_threshold=str(crasher.default_threshold),
fixed_fields=list(crasher.config.UserInterface.fixed_summary_fields),
)
if filename and os.path.exists(relative('ui/app/', filename)):
if 'main.css' in filename:
css = current_app.response_class(
render_template(filename, **context),
mimetype="text/css")
return css
else:
# It's a static file.
return send_from_directory(relative('ui/app/'), filename)
elif filename and 'views/' in filename and filename.endswith('.html'):
# 404 on missing view...
# If this is not here, Angular could try to load the index page in
# an infinite loop. Which is bad.
return '', 404
# Otherwise, it's a route in the web app.
return render_template('index.html', **context)
评论列表
文章目录