Esempio n. 1
0
 def _make_storage_config(self, config):
     storage = config['storage']
     storage_type = storage['type']
     if storage_type == 'posix':
         storage_config = StorageConfig.make_posix_config()
     elif storage_type == 'gcs':
         storage_config = StorageConfig.make_gcs_config(storage['bucket'])
     elif storage_type == 's3':
         storage_config = StorageConfig.make_s3_config(
             storage['bucket'], storage['region'], storage['endpoint'])
     else:
         raise ScannerException(
             'Unsupported storage type {}'.format(storage_type))
     return storage_config
Esempio n. 2
0
import enum
from storehouse import StorageConfig, StorageBackend
import traceback
from pprint import pprint
from esper.widget import *
from esper.prelude import *
import django.apps

ESPER_ENV = os.environ.get('ESPER_ENV')
BUCKET = os.environ.get('BUCKET')
DATA_PATH = os.environ.get('DATA_PATH')

if ESPER_ENV == 'google':
    storage_config = StorageConfig.make_gcs_config(BUCKET)
else:
    storage_config = StorageConfig.make_posix_config()
storage = StorageBackend.make_from_config(storage_config)

VTT_FROM_CAPTION_INDEX = True


# Prints and flushes (necessary for gunicorn logs)
def _print(*args):
    pprint((*args))
    sys.stdout.flush()


# Renders home page
def index(request):
    return render(request, 'index.html',
                  {'globals': json.dumps(esper_js_globals())})