-
Notifications
You must be signed in to change notification settings - Fork 8
/
app.py
46 lines (34 loc) · 1019 Bytes
/
app.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import random
import time
from flask import Flask, jsonify, render_template, send_from_directory
from flask_cors import CORS
from api.error_handlers import format_error
from api.tax_calculator.controllers import (
get_tax_brackets
)
app = Flask(__name__)
app.jinja_env.auto_reload = True
app.config['TEMPLATES_AUTO_RELOAD'] = True
CORS(app)
@app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/png')
@app.errorhandler(404)
def not_found_handler(e):
return jsonify({
'errors': format_error(
'That url was not found',
code='NOT_FOUND'
)
}), 404
@app.errorhandler(Exception)
def exception_handler(e):
return jsonify({
'errors': format_error(str(e), code='INTERNAL_SERVER_ERROR')
}), 500
@app.route('/')
def instructions():
return render_template('instructions.html')
from api.tax_calculator.routes import *