Example #1
0
    def setUp(self):
        self.app = create_app(confs["testing"])
        self.app_context = self.app.app_context()

        self.app_context.push()
        self.client = self.app.test_client(use_cookies=True)
Example #2
0
from apps.main import create_app

import uvicorn

app = create_app()

if __name__ == '__main__':
    uvicorn.run("manage:app",
                host="127.0.0.1",
                port=8888,
                reload=True,
                debug=True,
                log_level="info")
Example #3
0
#
# Created Time: 2019/12/31 2:31 下午
# Be From: ZouRi
# Last Modified: x
# e6b0b8e8bf9ce5b9b4e8bdbbefbc8ce6b0b8e8bf9ce783ade6b3aae79b88e79cb6
#
import os

from flask import jsonify

from apps.main import create_app, before_process, after_process
from apps.start_inspection.check_db import check_super_admin
from apps.views import register_front_blueprints
from apps.api import register_apis_blueprints

app = create_app(os.getenv('RUN_ENV') or 'default')
# 蓝图注册
register_front_blueprints(app)
register_apis_blueprints(app)


@app.before_request
def before_request():
    before_process()


@app.after_request
def after_request(response):
    return after_process(response)

Example #4
0
#!/usr/bin/env python

from flask_script import Manager, Shell

from apps.main import create_app
from apps.main.config import confs
from apps.main.cmd import (CmdTest, make_shell_context, CmdAdmin)
import os
import sys

if __name__ == "__main__":
    try:
        app = create_app(confs[os.environ['FLASK_CONFIG']])
    except KeyError:
        print("( FLASK_CONFIG ) didn'set")
        sys.exit(0)

    manager = Manager(app)
    manager.add_command("test", CmdTest())
    manager.add_command("shell", Shell(make_context=make_shell_context))
    manager.add_command("admin", CmdAdmin())
    manager.run()
else:
    print("Hi gunicorn")
    app = create_app(confs[os.environ['FLASK_CONFIG']])