poffw.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:poffw 作者: Gr1N 项目源码 文件源码
def get_app():
    redis = await aioredis.create_redis(('localhost', 6379,), db=1)

    app = web.Application()
    app['redis'] = redis

    aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader('templates/'),
                         context_processors=(static_processor,))

    app.router.add_route('GET', '/', handlers.index)
    app.router.add_route('GET', '/login', handlers.login_task)
    app.router.add_route('POST', '/login', handlers.login)
    app.router.add_static('/static', 'static')

    async def close_redis(app):
        app['redis'].close()

    app.on_shutdown.append(close_redis)

    return app
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号