예제 #1
0
파일: app.py 프로젝트: sevenwang/vj4
    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')
예제 #2
0
파일: app.py 프로젝트: imxieyi/vj4
    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')
예제 #3
0
파일: app.py 프로젝트: JoshOY/vj4
  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')
예제 #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')
예제 #5
0
파일: base.py 프로젝트: whitefirer/vj4
 def setUp(self):
   super(SmallcacheTestCase, self).setUp()
   smallcache.init()
예제 #6
0
파일: base.py 프로젝트: vijos/vj4
 def setUp(self):
   super(SmallcacheTestCase, self).setUp()
   smallcache.init()