【问题标题】:Non-blocking tornado instance on Openshift?Openshift上的非阻塞龙卷风实例?
【发布时间】:2017-01-20 03:27:28
【问题描述】:

我正在尝试创建 Tornado 网络服务器,并且快速启动使我成为了 Tornado 的标准项目,但根据文档,此配置被阻止。 我是非阻塞 python 的新手。

我有这个 wsgi 文件,它位于我的 PAAS 服务器的根文件夹中

#!/usr/bin/env python
import os
import imp
import sys

#
# Below for testing only
#
if __name__ == '__main__':
    ip   = 'localhost'
    port = 8051
    zapp = imp.load_source('application', 'wsgi/application')

    from wsgiref.simple_server import make_server
    httpd = make_server(ip, port, zapp.application)
    httpd.serve_forever()

这是主处理程序文件

#!/usr/bin/env python
import tornado.web

class MainHandler(tornado.web.RequestHandler):
     def get(self):
          self.render('index.html')

Application 文件夹包含这个

# Put here yours handlers.
import tornado.wsgi
from . import handlers

handlers = [(r'/',MainHandler),]


application = tornado.wsgi.WSGIApplication(handlers, **settings)

In WSGI mode asynchronous methods are not supported

uses WSGI to deploy the python applications

是否可以在 openshift 上将 python 应用程序配置为完全非阻塞

Though i have seen project that seemed to work

【问题讨论】:

    标签: python tornado openshift-origin


    【解决方案1】:

    如果您谈论的是 OpenShift V2(不是使用 Kubernetes/Docker 的 V3),那么您需要使用 app.py 文件,如下所述:

    【讨论】:

    • V3 是(下一代)Web 控制台?我想我是V2。我不确定我是否可以将网络服务器从 mod-wsgi 或任何其他 uWsgi 更改为 tornado。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-26
    • 1970-01-01
    相关资源
    最近更新 更多