-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmaverick-api.py
executable file
·41 lines (30 loc) · 1.01 KB
/
maverick-api.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
#!/usr/bin/env python3
"""
Tornado server for maverick-api
Samuel Dudley
Feb 2018
https://github.com/goodrobots/maverick-api
"""
__version__ = "1.2.2"
from tornado.options import options
from pathlib import Path, PurePath
# from maverick_api.modules.base.database import MavDatabase
from maverick_api.modules.base.setup.config import MavConfig
from maverick_api.modules.base.setup.logging import MavLogging
if __name__ == "__main__":
# Obtain basedir path (must be done from this script)
basedir = Path(__file__).resolve().parent.joinpath("maverick_api")
# Setup config
MavConfig(PurePath(basedir).joinpath("config", "maverick-api.conf"))
# Define basedir in options
options.basedir = str(basedir)
# Setup logging
MavLogging()
# Setup database
# MavDatabase()
# Instantiate and start api server
# Import at this point to allow config settings to take place
from maverick_api.modules.base.apiserver import ApiServer
api = ApiServer()
api.initialize()
api.serve()