コード例 #1
0
ファイル: service.py プロジェクト: zhuzi0474/demo_backend
def add(a, b):
    c = Config.get_config()
    return a + b
コード例 #2
0
                   default="dev",
                   help='app running environment',
                   type=str)
    options.define("port",
                   default=8888,
                   help="run on the given port",
                   type=int)
    options.parse_command_line()

    env = options.options.env
    Config.set_config_env(env)

    log_formatter = logging.Formatter(
        '%(asctime)s - %(levelname)s: %(message)s')
    app_handler = logging.handlers.TimedRotatingFileHandler(
        Config.get_config().LOG_PATH, 'D', 1, 10)
    app_log = logging.getLogger()
    app_handler.setFormatter(log_formatter)
    app_log.addHandler(app_handler)

    settings = dict(
        cookie_secret="61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
        debug=True,
        autoreload=True)
    handlers = [
        (r'/api/(.*)/(.*)', MainHandler),
    ]
    application = tornado.web.Application(handlers, **settings)
    port = options.options.port
    server = httpserver.HTTPServer(application, max_buffer_size=1048576000)
    server.bind(port)