Mini Shell

Direktori : /proc/self/root/opt/bakmgr/lib/python3.6/site-packages/bakmgr/dash/
Upload File :
Current File : //proc/self/root/opt/bakmgr/lib/python3.6/site-packages/bakmgr/dash/dash_app.py

from pathlib import Path
import sys
import secrets
from flask import Flask


def create_app():
    flask_app = Flask(__name__)
    with flask_app.app_context():
        secrets.token_hex()
        flask_app.config['TEMPLATES_AUTO_RELOAD'] = True
        flask_app.config['SECRET_KEY'] = get_secret()
        # pylint:disable=unused-import,import-outside-toplevel
        import bakmgr.dash.routing
    return flask_app


def get_secret():
    path = Path("/etc/bakmgr/.flask_secret")
    try:
        path.chmod(0o600)
        with open(path, encoding="utf-8") as file:
            secret_key = file.read().strip()
    except OSError:
        secret_key = ''
    if secret_key:
        return secret_key
    secret_key = secrets.token_hex(32)
    with open(path, 'w', encoding='utf-8') as file:
        path.chmod(0o600)
        file.write(secret_key)
    return secret_key


app = create_app()

if __name__ == '__main__':
    sys.exit("Invoked incorrectly")

Zerion Mini Shell 1.0