zoe-web.py 851 Bytes
Newer Older
1
2
3
4
5
import logging
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback

6
from zoe_web import app
7
8
9
from zoe_web.emails import email_task

from common.configuration import conf
10
11

DEBUG = True
12
log = logging.getLogger("zoe_web")
13
14
15


def main():
16
17
18
19
20
21
    if DEBUG:
        logging.basicConfig(level=logging.DEBUG)
        logging.getLogger("requests").setLevel(logging.WARNING)
        logging.getLogger("tornado").setLevel(logging.WARNING)

    print("Starting app...")
Daniele Venzano's avatar
Daniele Venzano committed
22
    app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
23
24

    http_server = HTTPServer(WSGIContainer(app))
25
    http_server.listen(4000, "0.0.0.0")
26
    ioloop = IOLoop.instance()
27
    PeriodicCallback(email_task, int(conf["email_task_interval"]) * 1000).start()
28
29
    ioloop.start()

30
31
32

if __name__ == "__main__":
    main()