本文整理汇总了Python中meinheld.server.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self, port, hostname, **kwargs):
from meinheld import server, patch
patch.patch_all()
print(" - Running Hosting Server using Meinheld")
print(" - http://%s:%s/" % (hostname, port))
server.listen((hostname, port))
server.run(self.app)
开发者ID:stone5495,项目名称:flask-boilerplate-utils,代码行数:7,代码来源:commands.py
示例2: run
def run(self, handler):
from meinheld import server
if self.quiet:
server.set_access_logger(None)
server.set_error_logger(None)
server.listen((self.host, self.port))
server.run(handler)
开发者ID:4Christopher,项目名称:pyload,代码行数:9,代码来源:servers.py
示例3: main
def main():
opts, args = getopt.parse_args()
if opts.debug:
application.debug = True
print "Server listen: http://%s:%s/" % (opts.address, opts.port)
server.listen((opts.address, opts.port))
server.run(application)
开发者ID:hagihala,项目名称:gily,代码行数:9,代码来源:server.py
示例4: test_sock
def test_sock():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
assert(type(s) == msocket.socket)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:10,代码来源:test_socket.py
示例5: test_connect_ex
def test_connect_ex():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.connect_ex(("localhost", 8000))
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:10,代码来源:test_socket.py
示例6: run
def run(self):
fd = self.socket.fileno()
server.set_keepalive(self.cfg.keepalive)
server.set_picoev_max_fd(self.cfg.worker_connections)
server.set_fastwatchdog(self.tmp.fileno(), self.ppid, int(self.timeout))
#server.set_watchdog(self.watchdog)
server.set_listen_socket(fd)
server.run(self.wsgi)
开发者ID:daqing15,项目名称:meinheld,代码行数:10,代码来源:gmeinheld.py
示例7: test_detach
def test_detach():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.detach()
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:10,代码来源:test_socket.py
示例8: test_fileno
def test_fileno():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
assert(s.fileno() > 2)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:10,代码来源:test_socket.py
示例9: test_getsockopt
def test_getsockopt():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
tr = s.getsockopt(msocket.IPPROTO_TCP, msocket.TCP_NODELAY)
assert(tr > 0)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:10,代码来源:test_socket.py
示例10: test_sendto
def test_sendto():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.connect(("localhost", 8000))
s.sendto(b"GET / HTTP/1.0\r\n\r\n", (b'localhost',8000))
assert(len(s.recv(1024)) == 135)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:11,代码来源:test_socket.py
示例11: test_connect_fail
def test_connect_fail():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
with raises(msocket.gaierror):
s.connect(("google.comaaa", 80))
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:11,代码来源:test_socket.py
示例12: meinheld_server_runner
def meinheld_server_runner(wsgi_app, global_config, **settings):
from meinheld import server, middleware
host = settings.get('host', '0.0.0.0')
port = int(settings.get('port', 8080))
server.listen((host, port))
server.set_access_logger(None)
server.set_error_logger(None)
print('Starting HTTP server on http://%s:%s' % (host, port))
server.run(middleware.WebSocketMiddleware(wsgi_app))
开发者ID:sokky,项目名称:wsocket,代码行数:11,代码来源:__init__.py
示例13: test_timeout
def test_timeout():
def _test():
val = 5
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.settimeout(val)
assert(val == s.gettimeout())
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:11,代码来源:test_socket.py
示例14: test_makefile
def test_makefile():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.connect(("localhost", 8000))
f = s.makefile()
assert(f)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:12,代码来源:test_socket.py
示例15: start
def start(name):
print "started server at "+str(host)+":"+str(port)
if name =="meinheld":
from meinheld import server
server.set_access_logger(None)
server.set_error_logger(None)
server.listen((host, port))
server.run(app)
elif name =="gevent":
#from gevent import wsgi
#wsgi.WSGIServer((host, port), application=app.application, log=None).serve_forever()
from gevent.pywsgi import WSGIServer
WSGIServer((host, port), app, log=None).serve_forever()
elif name =="bjoern":
import bjoern
bjoern.listen(app, host, port)
bjoern.run()
elif name =="eventlet":
import eventlet
from eventlet import wsgi
#worker_pool = eventlet.GreenPool(2000)
#wsgi.server(eventlet.listen(('', port)), app, custom_pool=worker_pool, log=file('/dev/null', 'w'))
# max_size
wsgi.server(eventlet.listen(('', port)), app, max_size=10000, log=file('/dev/null', 'w'))
elif name =="fapws":
import fapws._evwsgi as evwsgi
from fapws import base
evwsgi.start(host, str(port))
evwsgi.set_base_module(base)
evwsgi.wsgi_cb(('/', app))
evwsgi.set_debug(0)
evwsgi.run()
elif name=="uwsgi":
print ("""Enter this command in the console
\nsudo uwsgi --http :8000 --master --disable-logging --pythonpath /home/a/g --wsgi-file w.py --listen 2 --buffer-size 2048 --async 10000 --ugreen -p 4
""")
# http://osdir.com/ml/python-wsgi-uwsgi-general/2011-02/msg00136.html
#
# Re: strange SIGPIPE: writing to a closed pipe/socket/fd on image requested from facebook -msg#00136
"""
SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /1 (ip 127.0.0.1) !!!
uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 260]
IOError: write error
"""
cmd_txt = "sudo uwsgi --http :8000 --master --harakiri 1 --harakiri-verbose --close-on-exec --disable-logging --pythonpath /home/a/todo/test --wsgi-file w2.py --listen 2 --buffer-size 2048 --async 10000 --ugreen -p 4"
cmd(cmd_txt)
elif name=="pycgi":
from wsgiref.handlers import CGIHandler
CGIHandler().run(app)
elif name=="pystandard":
from wsgiref.simple_server import make_server
make_server(host, port, app).serve_forever()
开发者ID:guguncube,项目名称:python-presentation,代码行数:52,代码来源:wsgi-benchmark.py
示例16: test_getpeername
def test_getpeername():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.connect(("localhost", 8000))
assert(s)
host, port = s.getpeername()
assert(host == "127.0.0.1")
assert(port == 8000)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:14,代码来源:test_socket.py
示例17: test_sockname
def test_sockname():
def _test():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
shost, sport = s.getsockname()
ms = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
host, port = ms.getsockname()
assert(host == shost)
assert(port == sport)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:14,代码来源:test_socket.py
示例18: test_recvfrom
def test_recvfrom():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.connect(("localhost", 8000))
s.send(b"GET / HTTP/1.0\r\n")
s.send(b"\r\n")
c, addr = s.recvfrom(1024)
assert(len(c) == 135)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:15,代码来源:test_socket.py
示例19: run
def run(self):
if hasattr(self, "sockets"):
fds = [s.fileno() for s in self.sockets]
else:
fds = [self.socket.fileno()]
server.set_keepalive(self.cfg.keepalive)
server.set_picoev_max_fd(self.cfg.worker_connections)
server.set_fastwatchdog(self.tmp.fileno(), self.ppid, int(self.timeout))
#server.set_watchdog(self.watchdog)
server.set_listen_socket(fds)
server.run(self.wsgi)
开发者ID:V-E-O,项目名称:meinheld,代码行数:15,代码来源:gmeinheld.py
示例20: test_recv_into
def test_recv_into():
def _test():
s = msocket.socket(msocket.AF_INET, msocket.SOCK_STREAM)
s.connect(("localhost", 8000))
s.send(b"GET / HTTP/1.0\r\n")
s.send(b"\r\n")
buf = array.array('b', [0] *1024)
r = s.recv_into(buf)
assert(r == 135)
server.shutdown()
server.listen(("0.0.0.0", 8000))
server.spawn(_test)
server.run(App())
开发者ID:apackeer,项目名称:meinheld,代码行数:16,代码来源:test_socket.py
注:本文中的meinheld.server.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论