service.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:partycrasher 作者: naturalness 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号