blob: d566da7621befcc4ffba149a6d5a09ec01acc554 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# -*- coding: utf-8 -*-
from flask import Flask, render_template, g
from .main import main
def create_app(config=None):
"""Creates the Flask app."""
app = Flask(__name__)
configure_app(app)
configure_error_handlers(app)
app.register_blueprint(main)
return app
def configure_app(app):
app.config.from_pyfile('../config.cfg')
def configure_error_handlers(app):
@app.route('/403')
@app.errorhandler(403)
def forbidden():
return render_template('403.html'), 403
@app.errorhandler(400)
@app.errorhandler(404)
def errorhandler(e):
return render_template('404.html', error=e), e.code
|