52 lines
1.1 KiB
Python
Executable File
52 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
"""Application Flask: AutoSco"""
|
|
|
|
import os
|
|
from pprint import pprint as pp
|
|
|
|
import click
|
|
import flask
|
|
from flask.cli import with_appcontext
|
|
from flask.templating import render_template
|
|
|
|
import app as mapp
|
|
from app import create_app, cli
|
|
from app.utils import utils as scu
|
|
|
|
from config import RunningConfig
|
|
|
|
app = create_app(RunningConfig)
|
|
cli.register(app)
|
|
|
|
|
|
@app.context_processor
|
|
def inject_utils():
|
|
"Make scu available in all Jinja templates"
|
|
# if modified, put the same in conftest.py#27
|
|
return {
|
|
"DEBUG": flask.current_app.config["DEBUG"],
|
|
"scu": scu,
|
|
}
|
|
|
|
|
|
@app.shell_context_processor
|
|
def make_shell_context():
|
|
import app as mapp # le package app
|
|
from app.utils import sco_utils as scu
|
|
|
|
return {
|
|
"ctx": app.test_request_context(),
|
|
"current_app": flask.current_app,
|
|
"current_user": current_user,
|
|
"datetime": datetime,
|
|
"flask": flask,
|
|
"mapp": mapp,
|
|
"pp": pp,
|
|
"scu": scu,
|
|
}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
port = os.environ.get("PORT", 5001)
|
|
app.run(debug=True, port=port)
|