如何整合pynba和Flask的pythonic方式?

时间:2015-08-22 19:21:47

标签: python flask decorator wsgi

后 pip安装烧瓶 pip install pynba

我尝试使用代码


    import flask
    import pynba.wsgi

    class FlaskWithPynba(flask.Flask):
        @pynba.wsgi.monitor(('localhost', 30002))
        def wsgi_app(self, environ, start_response):
            super(FlaskWithPynba, self).wsgi_app(environ, start_response)

    app = FlaskWithPynba('myapp')

但在调用app.run()

时会出现一些错误

    Traceback (most recent call last):
      File "/home/coffee/venv/local/lib/python2.7/site-packages/flask/app.py", 
    line 1836, in __call__
        return self.wsgi_app(environ, start_response)
      File "pynba/wsgi/middleware.pyx", line 63, 
    in pynba.wsgi.middleware.PynbaMiddleware.__call__ (pynba/wsgi/middleware.c:1554)
      File "pynba/wsgi/middleware.pyx", line 64, 
    in pynba.wsgi.middleware.PynbaMiddleware.__call__ (pynba/wsgi/middleware.c:1510)
    TypeError: wsgi_app() takes exactly 3 arguments (2 given)

0 个答案:

没有答案