2020-10-21 11:07:10 +00:00
|
|
|
# First things first: apply monkey patch, so that no code gets executed without
|
|
|
|
# patched libraries!
|
2019-08-26 12:21:06 +00:00
|
|
|
import eventlet
|
2020-10-21 11:07:10 +00:00
|
|
|
eventlet.monkey_patch()
|
|
|
|
|
2022-02-03 11:39:16 +00:00
|
|
|
from app import db, cli, create_app # noqa
|
2022-02-08 11:26:20 +00:00
|
|
|
from app.models import (
|
|
|
|
Corpus,
|
|
|
|
CorpusFile,
|
|
|
|
Job,
|
|
|
|
JobInput,
|
|
|
|
JobResult,
|
|
|
|
Permission,
|
|
|
|
Role,
|
|
|
|
TesseractOCRModel,
|
2022-04-22 13:27:52 +00:00
|
|
|
TranskribusHTRModel,
|
2022-02-08 11:26:20 +00:00
|
|
|
User
|
|
|
|
) # noqa
|
2021-12-07 13:18:05 +00:00
|
|
|
from flask import Flask # noqa
|
|
|
|
from typing import Any, Dict # noqa
|
2020-10-21 11:07:10 +00:00
|
|
|
|
2019-07-03 08:31:23 +00:00
|
|
|
|
2021-12-07 13:18:05 +00:00
|
|
|
app: Flask = create_app()
|
2021-09-15 10:31:53 +00:00
|
|
|
cli.register(app)
|
2019-07-05 12:47:35 +00:00
|
|
|
|
|
|
|
|
2021-12-07 13:18:05 +00:00
|
|
|
@app.context_processor
|
|
|
|
def make_context() -> Dict[str, Any]:
|
|
|
|
''' Adds variables to the template context. '''
|
|
|
|
return {'Permission': Permission}
|
|
|
|
|
|
|
|
|
2019-07-05 12:47:35 +00:00
|
|
|
@app.shell_context_processor
|
2021-12-07 13:18:05 +00:00
|
|
|
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,
|
|
|
|
'Role': Role,
|
2022-02-03 11:39:16 +00:00
|
|
|
'TesseractOCRModel': TesseractOCRModel,
|
2022-04-22 13:27:52 +00:00
|
|
|
'TranskribusHTRModel': TranskribusHTRModel,
|
2021-12-07 13:18:05 +00:00
|
|
|
'User': User
|
|
|
|
}
|