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()
|
|
|
|
|
2024-04-11 12:33:47 +00:00
|
|
|
|
2024-09-25 15:46:53 +00:00
|
|
|
from typing import Any # noqa
|
2024-04-11 12:33:47 +00:00
|
|
|
from app import create_app, db, scheduler, socketio # noqa
|
|
|
|
from app import models # noqa
|
2020-10-21 11:07:10 +00:00
|
|
|
|
2019-07-03 08:31:23 +00:00
|
|
|
|
2024-09-25 15:46:53 +00:00
|
|
|
app = create_app()
|
2019-07-05 12:47:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
@app.shell_context_processor
|
2024-09-25 15:46:53 +00:00
|
|
|
def make_shell_context() -> dict[str, Any]:
|
2021-12-07 13:18:05 +00:00
|
|
|
''' Adds variables to the shell context. '''
|
|
|
|
return {
|
2023-02-23 12:05:04 +00:00
|
|
|
'db': db,
|
2024-04-11 12:33:47 +00:00
|
|
|
'Avatar': models.Avatar,
|
|
|
|
'Corpus': models.Corpus,
|
|
|
|
'CorpusFile': models.CorpusFile,
|
|
|
|
'CorpusFollowerAssociation': models.CorpusFollowerAssociation,
|
|
|
|
'CorpusFollowerRole': models.CorpusFollowerRole,
|
|
|
|
'Job': models.Job,
|
|
|
|
'JobInput': models.JobInput,
|
|
|
|
'JobResult': models.JobResult,
|
|
|
|
'Role': models.Role,
|
|
|
|
'TesseractOCRPipelineModel': models.TesseractOCRPipelineModel,
|
|
|
|
'SpaCyNLPPipelineModel': models.SpaCyNLPPipelineModel,
|
|
|
|
'User': models.User
|
2021-12-07 13:18:05 +00:00
|
|
|
}
|
2022-04-22 14:36:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2024-09-25 15:46:53 +00:00
|
|
|
with app.app_context():
|
|
|
|
scheduler.start()
|
2022-04-22 14:36:12 +00:00
|
|
|
socketio.run(app, host='0.0.0.0')
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2022-06-28 10:30:02 +00:00
|
|
|
main()
|