-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
34 lines (24 loc) · 829 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
import logging
import settings
from flask import Flask
from routes import routes
app = Flask(__name__)
from werkzeug.routing import BaseConverter
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
self.regex = items[0]
#regex paths
app.url_map.converters['regex'] = RegexConverter
#import the routes in routes.py
app.register_blueprint(routes)
#run the app
if __name__ == '__main__':
logging.basicConfig(filename=settings.LOGFILE,
level=logging.ERROR,
datefmt='%Y-%m-%d %H:%M:%S',
format='%(asctime)s %(levelname)s %(message)s')
app.run(host=settings.HOST,
port=settings.PORT,
threaded=True,
debug=settings.DEBUG)