#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# import traceback

from tornado import options, ioloop, web, process

from . import views
from .conf import setting


options.define('port', default=5000, type=int)
options.define('process', default=1, type=int)
options.define('debug', default=3, type=int)


def main():
    options.parse_command_line()

    _port = options.options.port
    _process_num = options.options.process
    _debug_level = options.options.debug * 10

    process.fork_processes(_process_num, max_restarts=3)

    process_port = _port + process.task_id()
    process_debug = _process_num <= 1 and _debug_level < 30

    print('Service Running on %d ...' % process_port)

    app = web.Application((
        (r'/', views.base.IndexHandler),
        (r'/home', views.base.HomeHandler),
        (r'/auth/redirect', views.auth.OAuth2RedirectHandler),
        (r'/auth/revoke', views.auth.OAuth2RevokeHandler),
        (r'/auth/authorize', views.auth.OAuth2AuthorizeHandler),
        (r'/auth/info', views.auth.OAuth2InfoHandler),
        (r'/user/info', views.rest.UserInfoHandler),
        (r'/user/option', views.rest.UserOptionHandler),
        (r'/weibo/public', views.rest.WeiboPublicHandler),
        (r'/weibo/sync', views.rest.WeiboSyncHandler),
        (r'/weibo/query', views.rest.WeiboQueryHandler),
        (r'/weibo/redirect', views.rest.WeiboRedirectHandler),
        (r'/emotion/query', views.rest.EmotionQueryHandler),
    ), debug=process_debug, cookie_secret=setting.COOKIE_SECRET)
    app.listen(process_port, xheaders=True)

    loop = ioloop.IOLoop.instance()
    loop.start()


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        if not process.task_id() is None:
            ioloop.IOLoop.current().stop()
        else:
            print('Capture KeyboardInterrupt. Try to stop service ...')


bd8fe3a4b568a5540ea61985ac1981d2224405ff
<mask token>

<mask token>


def main():
    options.parse_command_line()
    _port = options.options.port
    _process_num = options.options.process
    _debug_level = options.options.debug * 10
    process.fork_processes(_process_num, max_restarts=3)
    process_port = _port + process.task_id()
    process_debug = _process_num <= 1 and _debug_level < 30
    print('Service Running on %d ...' % process_port)
    app = web.Application((('/', views.base.IndexHandler), ('/home', views.
        base.HomeHandler), ('/auth/redirect', views.auth.
        OAuth2RedirectHandler), ('/auth/revoke', views.auth.
        OAuth2RevokeHandler), ('/auth/authorize', views.auth.
        OAuth2AuthorizeHandler), ('/auth/info', views.auth.
        OAuth2InfoHandler), ('/user/info', views.rest.UserInfoHandler), (
        '/user/option', views.rest.UserOptionHandler), ('/weibo/public',
        views.rest.WeiboPublicHandler), ('/weibo/sync', views.rest.
        WeiboSyncHandler), ('/weibo/query', views.rest.WeiboQueryHandler),
        ('/weibo/redirect', views.rest.WeiboRedirectHandler), (
        '/emotion/query', views.rest.EmotionQueryHandler)), debug=
        process_debug, cookie_secret=setting.COOKIE_SECRET)
    app.listen(process_port, xheaders=True)
    loop = ioloop.IOLoop.instance()
    loop.start()


<mask token>

<mask token>
options.define('port', default=5000, type=int)
options.define('process', default=1, type=int)
options.define('debug', default=3, type=int)


def main():
    options.parse_command_line()
    _port = options.options.port
    _process_num = options.options.process
    _debug_level = options.options.debug * 10
    process.fork_processes(_process_num, max_restarts=3)
    process_port = _port + process.task_id()
    process_debug = _process_num <= 1 and _debug_level < 30
    print('Service Running on %d ...' % process_port)
    app = web.Application((('/', views.base.IndexHandler), ('/home', views.
        base.HomeHandler), ('/auth/redirect', views.auth.
        OAuth2RedirectHandler), ('/auth/revoke', views.auth.
        OAuth2RevokeHandler), ('/auth/authorize', views.auth.
        OAuth2AuthorizeHandler), ('/auth/info', views.auth.
        OAuth2InfoHandler), ('/user/info', views.rest.UserInfoHandler), (
        '/user/option', views.rest.UserOptionHandler), ('/weibo/public',
        views.rest.WeiboPublicHandler), ('/weibo/sync', views.rest.
        WeiboSyncHandler), ('/weibo/query', views.rest.WeiboQueryHandler),
        ('/weibo/redirect', views.rest.WeiboRedirectHandler), (
        '/emotion/query', views.rest.EmotionQueryHandler)), debug=
        process_debug, cookie_secret=setting.COOKIE_SECRET)
    app.listen(process_port, xheaders=True)
    loop = ioloop.IOLoop.instance()
    loop.start()


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        if not process.task_id() is None:
            ioloop.IOLoop.current().stop()
        else:
            print('Capture KeyboardInterrupt. Try to stop service ...')

from tornado import options, ioloop, web, process
from . import views
from .conf import setting
options.define('port', default=5000, type=int)
options.define('process', default=1, type=int)
options.define('debug', default=3, type=int)


def main():
    options.parse_command_line()
    _port = options.options.port
    _process_num = options.options.process
    _debug_level = options.options.debug * 10
    process.fork_processes(_process_num, max_restarts=3)
    process_port = _port + process.task_id()
    process_debug = _process_num <= 1 and _debug_level < 30
    print('Service Running on %d ...' % process_port)
    app = web.Application((('/', views.base.IndexHandler), ('/home', views.
        base.HomeHandler), ('/auth/redirect', views.auth.
        OAuth2RedirectHandler), ('/auth/revoke', views.auth.
        OAuth2RevokeHandler), ('/auth/authorize', views.auth.
        OAuth2AuthorizeHandler), ('/auth/info', views.auth.
        OAuth2InfoHandler), ('/user/info', views.rest.UserInfoHandler), (
        '/user/option', views.rest.UserOptionHandler), ('/weibo/public',
        views.rest.WeiboPublicHandler), ('/weibo/sync', views.rest.
        WeiboSyncHandler), ('/weibo/query', views.rest.WeiboQueryHandler),
        ('/weibo/redirect', views.rest.WeiboRedirectHandler), (
        '/emotion/query', views.rest.EmotionQueryHandler)), debug=
        process_debug, cookie_secret=setting.COOKIE_SECRET)
    app.listen(process_port, xheaders=True)
    loop = ioloop.IOLoop.instance()
    loop.start()


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        if not process.task_id() is None:
            ioloop.IOLoop.current().stop()
        else:
            print('Capture KeyboardInterrupt. Try to stop service ...')

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# import traceback

from tornado import options, ioloop, web, process

from . import views
from .conf import setting


options.define('port', default=5000, type=int)
options.define('process', default=1, type=int)
options.define('debug', default=3, type=int)


def main():
    options.parse_command_line()

    _port = options.options.port
    _process_num = options.options.process
    _debug_level = options.options.debug * 10

    process.fork_processes(_process_num, max_restarts=3)

    process_port = _port + process.task_id()
    process_debug = _process_num <= 1 and _debug_level < 30

    print('Service Running on %d ...' % process_port)

    app = web.Application((
        (r'/', views.base.IndexHandler),
        (r'/home', views.base.HomeHandler),
        (r'/auth/redirect', views.auth.OAuth2RedirectHandler),
        (r'/auth/revoke', views.auth.OAuth2RevokeHandler),
        (r'/auth/authorize', views.auth.OAuth2AuthorizeHandler),
        (r'/auth/info', views.auth.OAuth2InfoHandler),
        (r'/user/info', views.rest.UserInfoHandler),
        (r'/user/option', views.rest.UserOptionHandler),
        (r'/weibo/public', views.rest.WeiboPublicHandler),
        (r'/weibo/sync', views.rest.WeiboSyncHandler),
        (r'/weibo/query', views.rest.WeiboQueryHandler),
        (r'/weibo/redirect', views.rest.WeiboRedirectHandler),
        (r'/emotion/query', views.rest.EmotionQueryHandler),
    ), debug=process_debug, cookie_secret=setting.COOKIE_SECRET)
    app.listen(process_port, xheaders=True)

    loop = ioloop.IOLoop.instance()
    loop.start()


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        if not process.task_id() is None:
            ioloop.IOLoop.current().stop()
        else:
            print('Capture KeyboardInterrupt. Try to stop service ...')

