2018-06-25 18:29:57 +02:00
#!/usr/bin/env python
# coding: utf-8
2018-06-26 11:39:43 +02:00
import functools
import json
2018-06-25 18:29:57 +02:00
import bottle
2018-06-25 17:12:17 +02:00
from server import routes
2018-06-26 11:39:43 +02:00
from server . jsonapi import DateAwareJSONEncoder
2018-06-25 17:12:17 +02:00
from server . models import db , Report
2018-06-25 18:29:57 +02:00
if __name__ == " __main__ " :
db . connect ( )
db . create_tables ( [ Report ] )
2018-06-26 11:39:43 +02:00
# Use DateAwareJSONEncoder to dump JSON strings
# From http://stackoverflow.com/questions/21282040/bottle-framework-how-to-return-datetime-in-json-response#comment55718456_21282666. pylint: disable=locally-disabled,line-too-long
bottle . install (
bottle . JSONPlugin (
json_dumps = functools . partial ( json . dumps , cls = DateAwareJSONEncoder )
)
)
2018-06-25 18:29:57 +02:00
bottle . run ( host = ' 0.0.0.0 ' , port = ' 8081 ' )