2018-05-09 20:11:21 +00:00
|
|
|
import os
|
|
|
|
import json
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from datetime import timedelta, datetime
|
|
|
|
|
|
|
|
from cachetools import lru_cache
|
2018-05-14 17:12:42 +00:00
|
|
|
# from flask import (abort, redirect, request, url_for, make_response, Response, render_template,
|
|
|
|
# Blueprint, jsonify, send_file, session)
|
|
|
|
from flask import Blueprint
|
|
|
|
# from flask_login import current_user
|
2018-05-09 20:11:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
from app import (app)
|
2018-05-14 17:12:42 +00:00
|
|
|
# from endpoints.api.discovery import swagger_route_data
|
|
|
|
from common import render_page_template
|
2018-05-09 20:11:21 +00:00
|
|
|
from util.cache import no_cache
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-05-14 17:12:42 +00:00
|
|
|
# @lru_cache(maxsize=1)
|
|
|
|
# def _get_route_data():
|
|
|
|
# return swagger_route_data(include_internal=True, compact=True)
|
2018-05-09 20:11:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
def render_page_template_with_routedata(name, *args, **kwargs):
|
2018-05-14 17:12:42 +00:00
|
|
|
return render_page_template(name, *args, **kwargs)
|
2018-05-09 20:11:21 +00:00
|
|
|
|
|
|
|
# Capture the unverified SSL errors.
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logging.captureWarnings(True)
|
|
|
|
|
2018-05-14 15:27:56 +00:00
|
|
|
setup_web = Blueprint('setup_web', __name__, template_folder='templates')
|
2018-05-09 20:11:21 +00:00
|
|
|
|
2018-05-14 17:12:42 +00:00
|
|
|
# STATUS_TAGS = app.config['STATUS_TAGS']
|
2018-05-09 20:11:21 +00:00
|
|
|
|
|
|
|
@setup_web.route('/', methods=['GET'], defaults={'path': ''})
|
|
|
|
@no_cache
|
|
|
|
def index(path, **kwargs):
|
2018-05-10 17:22:53 +00:00
|
|
|
return render_page_template_with_routedata('config_index.html', js_bundle_name='configapp', **kwargs)
|
2018-05-09 20:11:21 +00:00
|
|
|
|
|
|
|
@setup_web.errorhandler(404)
|
|
|
|
@setup_web.route('/404', methods=['GET'])
|
|
|
|
def not_found_error_display(e = None):
|
|
|
|
resp = index('', error_code=404, error_info=dict(reason='notfound'))
|
|
|
|
resp.status_code = 404
|
|
|
|
return resp
|