visionHub
Entrypoint for the Vision Hub application.
1# Code created with support of Miguel Grinberg's The Flash Mega Tutorial series 2# https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iv-database 3"""Entrypoint for the Vision Hub application.""" 4import sqlalchemy as sa 5import sqlalchemy.orm as so 6 7from app import app, db 8from app.models import ( 9 User, 10 Role, 11 Department, 12 TrainingModule, 13 Question, 14 Option, 15 UserModuleProgress, 16 UserQuestionAnswer 17) 18 19@app.shell_context_processor 20def make_shell_context(): 21 """Provide names and objects to the Flask shell for quick access.""" 22 return { 23 'sa': sa, 24 'so': so, 25 'db': db, 26 'User': User, 27 'Role': Role, 28 'Department': Department, 29 'TrainingModule': TrainingModule, 30 'Question': Question, 31 'Option': Option, 32 'UserModuleProgress': UserModuleProgress, 33 'UserQuestionAnswer': UserQuestionAnswer, 34 } 35 36if __name__ == "__main__": 37 port = int(os.environ.get("PORT", 8000)) 38 app.run(host="0.0.0.0", port=port, debug=False)
@app.shell_context_processor
def
make_shell_context():
20@app.shell_context_processor 21def make_shell_context(): 22 """Provide names and objects to the Flask shell for quick access.""" 23 return { 24 'sa': sa, 25 'so': so, 26 'db': db, 27 'User': User, 28 'Role': Role, 29 'Department': Department, 30 'TrainingModule': TrainingModule, 31 'Question': Question, 32 'Option': Option, 33 'UserModuleProgress': UserModuleProgress, 34 'UserQuestionAnswer': UserQuestionAnswer, 35 }
Provide names and objects to the Flask shell for quick access.