Files
cellxgene/server/app/web/webapp.py
James Taylor f2eb2cad82 Use url_root from Flask rather than hardcoding hostname. (#520)
Allows running in a container on a remote host, should also allow running
behind a proxy with a url prefix.
2018-12-19 16:20:26 -08:00

25 lines
652 B
Python

import os
from flask import Blueprint, render_template, send_from_directory, current_app, request
bp = Blueprint("webapp", __name__, template_folder="templates")
@bp.route("/")
def index():
url_base = request.url_root + "api/"
dataset_title = current_app.config["DATASET_TITLE"]
return render_template("index.html", prefix=url_base, datasetTitle=dataset_title)
# renders swagger documentation
@bp.route("/swagger")
def swag():
return render_template("swagger.html")
# renders swagger documentation
@bp.route("/favicon.png")
def favicon():
return send_from_directory(os.path.join(bp.root_path, "static/img/"), "favicon.png")