本文整理汇总了Python中application.Application.listen方法的典型用法代码示例。如果您正苦于以下问题:Python Application.listen方法的具体用法?Python Application.listen怎么用?Python Application.listen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.Application
的用法示例。
在下文中一共展示了Application.listen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import listen [as 别名]
def run():
# setup signal handling
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGINT, signal_handler)
io_loop = tornado.ioloop.IOLoop.instance()
app = Application(config.settings, io_loop)
# Hook RabbitMQ consumer into Tornado IOLoop
logging.info("Hooking RabbitMQ Consumer into IOLoop...")
io_loop.add_timeout(time.time() + .1, app.rabbitmq.run)
logging.info("complete.")
logging.info("Starting Tornado on Port %s", config.settings['tornado']['port'])
app.listen(config.settings['tornado']['port'])
io_loop.start()
示例2: define
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import listen [as 别名]
import tornado.options
import tornado.ioloop
import tornado.autoreload
import config
import initial
from application import Application
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=int)
define("db_name", default="zgxx_db", help="storm config for database")
define("db_user", default="gxx_dbuser", help=u"数据库登录名")
define("db_password", default="Y64eXDUcLE6HcpqW", help=u"数据库登录密码")
define("db_host", default="127.0.0.1", help=u"数据库服务器地址")
define("db_port", default=5432, help=u"数据库服务器端口", type=int)
config.database_none.init(options.db_name,
user=options.db_user,
password=options.db_password,
host=options.db_host,
port=options.db_port)
config.database_none.autorollback = True
if __name__ == '__main__':
tornado.options.parse_command_line()
initial.create_tables()
application = Application()
application.listen(options.port)
tornado.ioloop.IOLoop.current().start()
示例3: main
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import listen [as 别名]
def main():
application = Application()
application.listen(config.PORT)
tornado.ioloop.IOLoop.instance().start()
示例4: main
# 需要导入模块: from application import Application [as 别名]
# 或者: from application.Application import listen [as 别名]
def main():
tornado.options.parse_command_line()
application = Application()
application.listen(tornado.options.options.port)
tornado.ioloop.IOLoop.current().start()