Exemple #1
0
    def __init__(self):
        super(Application, self).__init__(debug=options.debug)
        globals()[self.__class__.__name__] = lambda: self  # singleton

        # Initialize components.
        translation_path = path.join(path.dirname(__file__), 'locale')
        locale.load_translations(translation_path)
        self.loop.run_until_complete(
            asyncio.gather(tools.ensure_all_indexes(), bus.init()))
        smallcache.init()

        # Load views.
        from vj4.handler import contest
        from vj4.handler import discussion
        from vj4.handler import domain
        from vj4.handler import home
        from vj4.handler import judge
        from vj4.handler import misc
        from vj4.handler import problem
        from vj4.handler import record
        from vj4.handler import training
        from vj4.handler import user
        from vj4.handler import i18n
        if options.static:
            self.router.add_static('/',
                                   path.join(path.dirname(__file__),
                                             '.uibuild'),
                                   name='static')
Exemple #2
0
    def __init__(self):
        super(Application, self).__init__(debug=options.debug)
        globals()[self.__class__.__name__] = lambda: self  # singleton

        static_path = path.join(path.dirname(__file__), '.uibuild')

        # Initialize components.
        staticmanifest.init(static_path)
        loop = asyncio.get_event_loop()
        loop.run_until_complete(db.init())
        loop.run_until_complete(system.setup())
        loop.run_until_complete(system.ensure_db_version())
        loop.run_until_complete(
            asyncio.gather(tools.ensure_all_indexes(), bus.init()))
        smallcache.init()

        # Load views.
        from vj4.handler import contest
        from vj4.handler import discussion
        from vj4.handler import domain
        from vj4.handler import fs
        from vj4.handler import home
        from vj4.handler import judge
        from vj4.handler import misc
        from vj4.handler import problem
        from vj4.handler import record
        from vj4.handler import training
        from vj4.handler import user
        from vj4.handler import i18n
        if options.static:
            self.router.add_static('/', static_path, name='static')
Exemple #3
0
  def __init__(self):
    super(Application, self).__init__(
      handler_factory=functools.partial(web.RequestHandlerFactory, access_log=None),
      debug=options.options.debug)
    globals()[self.__class__.__name__] = lambda: self  # singleton

    # Initialize components.
    translation_path = path.join(path.dirname(__file__), 'locale')
    locale.load_translations(translation_path)
    self.loop.run_until_complete(asyncio.gather(tools.ensure_all_indexes(), bus.init()))
    smallcache.init()

    # Load views.
    from vj4.handler import contest
    from vj4.handler import discussion
    from vj4.handler import home
    from vj4.handler import judge
    from vj4.handler import main
    from vj4.handler import problem
    from vj4.handler import record
    from vj4.handler import training
    from vj4.handler import user
    from vj4.handler import i18n
    if options.options.static:
      self.router.add_static('/', path.join(path.dirname(__file__), '.uibuild'), name='static')
Exemple #4
0
    def __init__(self):
        middlewares = []
        if options.sentry_dsn:
            middlewares.append(
                SentryMiddleware({
                    'dsn': options.sentry_dsn,
                    'environment': 'vj4',
                    'debug': options.debug,
                }))

        super(Application, self).__init__(debug=options.debug,
                                          middlewares=middlewares,
                                          client_max_size=10 * 1024**2)
        globals()[self.__class__.__name__] = lambda: self  # singleton

        static_path = path.join(path.dirname(__file__), '.uibuild')

        # Initialize components.
        staticmanifest.init(static_path)
        loop = asyncio.get_event_loop()
        loop.run_until_complete(db.init())
        loop.run_until_complete(system.setup())
        loop.run_until_complete(system.ensure_db_version())
        loop.run_until_complete(
            asyncio.gather(tools.ensure_all_indexes(), bus.init()))
        smallcache.init()

        # Load views.
        from vj4.handler import contest
        from vj4.handler import discussion
        from vj4.handler import domain
        from vj4.handler import fs
        from vj4.handler import home
        from vj4.handler import homework
        from vj4.handler import judge
        from vj4.handler import misc
        from vj4.handler import problem
        from vj4.handler import record
        from vj4.handler import training
        from vj4.handler import ranking
        from vj4.handler import user
        from vj4.handler import i18n
        from vj4.handler import report

        if options.static:
            self.router.add_static('/', static_path, name='static')