mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
# First things first: apply monkey patch, so that no code gets executed without
|
|
# patched libraries!
|
|
import eventlet
|
|
eventlet.monkey_patch()
|
|
|
|
from app.models import (Corpus, CorpusFile, Job, JobInput, JobResult,
|
|
Permission, QueryResult, Role, TesseractOCRModel, User) # noqa
|
|
from app import db, cli, create_app # noqa
|
|
from flask import Flask # noqa
|
|
from typing import Any, Dict # noqa
|
|
|
|
|
|
app: Flask = create_app()
|
|
cli.register(app)
|
|
|
|
|
|
@app.context_processor
|
|
def make_context() -> Dict[str, Any]:
|
|
''' Adds variables to the template context. '''
|
|
return {'Permission': Permission}
|
|
|
|
|
|
@app.shell_context_processor
|
|
def make_shell_context() -> Dict[str, Any]:
|
|
''' Adds variables to the shell context. '''
|
|
return {
|
|
'Corpus': Corpus,
|
|
'CorpusFile': CorpusFile,
|
|
'db': db,
|
|
'Job': Job,
|
|
'JobInput': JobInput,
|
|
'JobResult': JobResult,
|
|
'Permission': Permission,
|
|
'QueryResult': QueryResult,
|
|
'Role': Role,
|
|
'TesseractOCRModel': TesseractOCRModel,
|
|
'User': User
|
|
}
|