tornado 多线程服务器配置
来源:互联网 发布:软件设计师大纲 编辑:程序博客网 时间:2024/05/22 17:48
# coding:utf8
import tornado.web
import tornado.ioloop
import tornado.options
import tornado.httpserver
import tornado.netutil
import tornado.process
from tornado.options import options, define
define("port", type=int, default=9000)
class IndexHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
self.write("<h1>hello world !</h1>")
urls = [
(r"/", IndexHandler)
]
configs = dict(
debug=True
)
class CustomApplication(tornado.web.Application):
def __init__(self, configs, urls):
settings = configs
handlers = urls
super(CustomApplication, self).__init__(handlers=handlers, **settings)
def create_app(n):
tornado.options.parse_command_line()
sockets = tornado.netutil.bind_sockets(options.port)
tornado.process.fork_processes(n)
http_server = tornado.httpserver.HTTPServer(CustomApplication(configs, urls))
http_server.add_sockets(sockets)
tornado.ioloop.IOLoop.instance().start()
app = create_app
if __name__ == "__main__":
app(0)
import tornado.web
import tornado.ioloop
import tornado.options
import tornado.httpserver
import tornado.netutil
import tornado.process
from tornado.options import options, define
define("port", type=int, default=9000)
class IndexHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
self.write("<h1>hello world !</h1>")
urls = [
(r"/", IndexHandler)
]
configs = dict(
debug=True
)
class CustomApplication(tornado.web.Application):
def __init__(self, configs, urls):
settings = configs
handlers = urls
super(CustomApplication, self).__init__(handlers=handlers, **settings)
def create_app(n):
tornado.options.parse_command_line()
sockets = tornado.netutil.bind_sockets(options.port)
tornado.process.fork_processes(n)
http_server = tornado.httpserver.HTTPServer(CustomApplication(configs, urls))
http_server.add_sockets(sockets)
tornado.ioloop.IOLoop.instance().start()
app = create_app
if __name__ == "__main__":
app(0)
阅读全文
0 0
- tornado 多线程服务器配置
- tornado单线程服务器配置
- Web服务器 Tornado 2.0
- Tornado Web 服务器
- Tornado http服务器篇
- Tornado写简易服务器
- Tornado Web服务器
- tornado web服务器概览
- Tornado Web服务器
- Tornado写简易服务器
- Tornado Web服务器概览
- Tornado配置Source Insight
- Tornado 配置EditPlus编辑器
- tornado target server 配置
- MAC安装配置Tornado
- tornado静态文件配置
- tornado服务器session模块mongosion
- Tornado服务器环境的安装
- 让流程保持健康?删除!
- javascript中判断数据类型的四种方法及typeof、instanceof、constructor、toString
- SKILLCAD v41R Linux64 1CD+Keyshot Pro v7.0.438
- 数据结构 第15讲 一场说走就走的旅行——最短路径
- 最常用的PHP正则表达式收集整理
- tornado 多线程服务器配置
- 安卓MVP设计模式
- Qualcomm最新推出的神经处理引擎
- 2018 js教学难点汇集
- L2-005. 集合相似度
- leetcode 108. Convert Sorted Array to Binary Search Tree 构建平衡二叉搜索树 + DFS
- AMBA and AXI
- flashcache Unknown symbol in module
- 第三周项目一(2)—顺序表的基本运算