#!/usr/bin/python3 import sys import time from flask import Flask, abort, render_template, redirect, url_for, request from werkzeug.exceptions import default_exceptions import jinja2.exceptions app = Flask(__name__) app.jinja_env.auto_reload = True app.config['TEMPLATES_AUTO_RELOAD'] = True @app.context_processor def injetar_dados_basicos(): return dict(organizacao = 'FederANA') def generic_handler(e): return render_template('/erro.html', erro = e), getattr(e, 'code', 500) for codigo in default_exceptions: app.errorhandler(codigo)(generic_handler) @app.route('/') def index(): return redirect('/index.html') @app.route('/.html') def ver_pagina(caminho): try: return render_template('/' + caminho + '.html') except jinja2.exceptions.TemplateNotFound as e: abort(404)