# Path: feet/www/urls.py
# def make_app():
#     return Application(handlers())
# 
# Path: feet/config.py
# class RedisConfiguration(Configuration):
# class ServerConfiguration(Configuration):
# class MecabConfiguration(Configuration):
# class FeetConfiguration(Configuration):
#     CONF_PATHS = [
#         "/etc/feet.yaml",  # System configuration
#         os.path.expanduser("~/.feet.yaml"),  # User specific config
#         os.path.abspath("conf/feet.yaml"),  # Local configuration
#     ]


import os
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.httpclient
from feet.www.urls import make_app
from feet.config import settings
# Copyright (C) 2016 Romary Dupuis
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html

"""
TornadoWeb application definition in Feet.
"""

# tornado Web server


tornado_settings = {
    "static_path": os.path.join(os.path.dirname(__file__), "static"),
    "cookie_secret": "__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
    "login_url": "/login",
    "xsrf_cookies": True,
}


def run(host, port, debug):
    app = make_app()
    app.listen(port)
    logging.info('Feet server listening on port %d' % (port))
    try:
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        logging.info('Feet server interrupted')


if __name__ == "__main__":
    # if you run this file as a script, it will start the tornado Web server

# Path: feet/www/urls.py
# def make_app():
#     return Application(handlers())
# 
# Path: feet/config.py
# class RedisConfiguration(Configuration):
# class ServerConfiguration(Configuration):
# class MecabConfiguration(Configuration):
# class FeetConfiguration(Configuration):
#     CONF_PATHS = [
#         "/etc/feet.yaml",  # System configuration
#         os.path.expanduser("~/.feet.yaml"),  # User specific config
#         os.path.abspath("conf/feet.yaml"),  # Local configuration
#     ]


# Path: feet/www/app.py
import os
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.httpclient
from feet.www.urls import make_app
from feet.config import settings

# Copyright (C) 2016 Romary Dupuis
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html

"""
TornadoWeb application definition in Feet.
"""

# tornado Web server


tornado_settings = {
    "static_path": os.path.join(os.path.dirname(__file__), "static"),
    "cookie_secret": "__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
    "login_url": "/login",
    "xsrf_cookies": True,
}


def run(host, port, debug):
    app = make_app()
    app.listen(port)
    logging.info('Feet server listening on port %d' % (port))
    try:
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        logging.info('Feet server interrupted')


if __name__ == "__main__":
    # if you run this file as a script, it will start the tornado Web server

    run(host=settings.server.host, port=settings.server.port)