使用python烧瓶模块,我想拥有
app = flask.Flask(__name__)
作为类的属性:
class Handler(object):
def __init__(self):
self.datastores = {}
self.websocket_queue = gevent.queue.JoinableQueue()
self.app = flask.Flask(__name__)
问题是如何访问装饰器呢?
@self.app.route('/socket.io/<path:remaining>')
def socketio(self, remaining):
这会产生错误NameError: name 'self' is not defined
谢谢