예제 #1
0
 def run(self):
     force_init_app()
     if ctx.es is None:
         ctx.log.error(
             "elasticsearch is not configured properly, giving up")
         return
     if self.args.action == 'index':
         self.reindex()
예제 #2
0
 def run(self):
     force_init_app()
     if hasattr(ctx, "queue"):
         del ctx.queue
     ctx.queue = DummyQueue({})
     if self.args.drop:
         self.drop()
     else:
         self.create()
예제 #3
0
 def run(self):
     force_init_app()
     bot_type = self.args.bot_type[0]
     if bot_type == "telegram":
         bot = TelegramBot()
         bot.start()
     elif bot_type == "icq":
         bot = ICQBot()
         bot.start()
예제 #4
0
 def setUpClass(cls) -> None:
     force_init_app()
     super().setUpClass()
     User.ensure_indexes()
     cls.app = app
예제 #5
0
파일: wsgi.py 프로젝트: viert/knowledgehub
import os
from cachelib import SimpleCache
from glasskit import ctx
from ask import app, force_init_app

force_init_app()

if isinstance(ctx.cache, SimpleCache):
    if not os.getenv("GLASSKIT_USE_SIMPLE_CACHE"):
        raise RuntimeError(
            """Running your application under uwsgi control without centralized cache
is dangerous. If you rely on cache invalidation your app instances will be
able to invalidate their own in-memory cache while others will consider the
same cache keys still valid.

If you're sure it's OK for your project please set:
 
GLASSKIT_USE_SIMPLE_CACHE=1

""")

app_callable = app.flask