示例#1
0
文件: server.py 项目: zaoliu/haven
flask_app = Flask(__name__)


@flask_app.route('/http')
def http():
    return u'http ok'


app = WSGHaven(Box, '/echo', flask_app)


@app.route(101)
def index(request):
    request.write(dict(
        ret=1,
        body=repr(request.address),
    ))


@app.repeat_timer(60)
def timer():
    logger.debug('timer')


if __name__ != '__main__':
    # 启动timer之类的
    app._on_worker_run()

if __name__ == '__main__':
    app.run('127.0.0.1', 8000, workers=2)
示例#2
0
flask_app = Flask(__name__)


@flask_app.route('/http')
def http():
    return u'http ok'

app = WSGHaven(Box, '/echo', flask_app)


@app.route(101)
def index(request):
    request.write(dict(
        ret=1,
        body=repr(request.address),
    ))


@app.repeat_timer(60)
def timer():
    logger.debug('timer')


if __name__ != '__main__':
    # 启动timer之类的
    app._on_worker_run()

if __name__ == '__main__':
    app.run('127.0.0.1', 8000, workers=2)
示例#3
0
文件: server.py 项目: 763363605/haven
flask_app = Flask(__name__)


@flask_app.route('/http')
def http():
    return 'http ok'


app = WSGHaven(Box, '/echo', flask_app)


@app.route(101)
def index(request):
    request.write(dict(
        ret=1,
        body=repr(request.address),
    ))


@app.repeat_timer(60)
def timer():
    logger.debug('timer')


if __name__ != '__main__':
    # 启动timer之类的
    app._on_worker_start()

if __name__ == '__main__':
    app.run('127.0.0.1', 8000)