50 lines
1014 B
Python
Executable File
50 lines
1014 B
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
|
|
from scodoc import api
|
|
|
|
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 {
|
|
"cfg": RunningConfig,
|
|
"DEBUG": flask.current_app.config["DEBUG"],
|
|
"scu": scu,
|
|
}
|
|
|
|
|
|
@app.shell_context_processor
|
|
def make_shell_context():
|
|
import app as mapp # le package app
|
|
|
|
return {
|
|
"api": api,
|
|
"ctx": app.test_request_context(),
|
|
"current_app": flask.current_app,
|
|
"flask": flask,
|
|
"mapp": mapp,
|
|
"pp": pp,
|
|
}
|
|
|
|
# Start using:
|
|
# flask run -p 5001 --host 0.0.0.0 --debug
|
|
|