-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
44 lines (32 loc) · 1.4 KB
/
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
import logging
from datetime import date, datetime, timedelta
from flask import Flask, send_from_directory
from flask.json import JSONEncoder
from flask_scss import Scss
from application.factory import ApplicationFactory
from infrastructure.logger import init
from view.create_views import CreateViewsFor
dashMeMoneyApplication = Flask(__name__,
static_folder='templates/assets')
logging.basicConfig(level=logging.DEBUG, format=f'%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s')
init(dashMeMoneyApplication.logger)
Scss(dashMeMoneyApplication, asset_dir='templates/assets',
static_dir='templates/assets').update_scss()
dashMeMoneyApplication.config['DEBUG'] = True
class CustomJSONEncoder(JSONEncoder):
def default(self, obj):
try:
if type(obj) == date:
return obj.isoformat()
if type(obj) == datetime:
return obj.isoformat(timespec="seconds")
except TypeError:
pass
return JSONEncoder.default(self, obj)
dashMeMoneyApplication.json_encoder = CustomJSONEncoder
@dashMeMoneyApplication.route('/favicon.ico')
def favicon():
return send_from_directory('templates/assets', 'favicon.ico', mimetype='image/vnd.microsoft.icon')
CreateViewsFor(dashMeMoneyApplication, ApplicationFactory())
if __name__ == '__main__':
dashMeMoneyApplication.run(debug=True, host='0.0.0.0')