app.py 523 B

1234567891011121314151617181920
  1. from aiohttp import web
  2. from aiohttp_session import setup
  3. from aiohttp_session.redis_storage import RedisStorage
  4. from aioredis import from_url
  5. from api_routes import routes as api_routes
  6. from view_routes import routes as view_routes
  7. from config import config
  8. app = web.Application()
  9. redis = from_url('redis://localhost')
  10. setup(app, RedisStorage(redis))
  11. app.add_routes([
  12. web.static('/static', './static')
  13. ])
  14. app.add_routes(api_routes)
  15. app.add_routes(view_routes)
  16. web.run_app(app, port=config.PORT)