def create_app3(): app3 = ExFlask("app3") app3.config["TESTING"] = True pm = PluginManager(pluginkit_config=dict(whoami="app3")) pm.init_app(app3) return app3
__license__ = "BSD 3-Clause License" import time, os.path, jinja2, sys, rq_dashboard from flask import request, g, render_template, redirect, make_response, url_for from flask_pluginkit import PluginManager, Flask from config import GLOBAL, SSO, PLUGINS, RQREDIS from utils.tool import logger, ChoiceColor, TagRandomColor, timestamp_to_timestring from utils.web import verify_sessionId, analysis_sessionId, get_redirect_url from urllib import urlencode from libs.api import ApiManager from views import api_blueprint, front_blueprint, admin_blueprint, upload_blueprint reload(sys) sys.setdefaultencoding('utf-8') #初始化定义application app = Flask(__name__) app.config.update( REDIS_URL=RQREDIS, RQ_POLL_INTERVAL=2500, ISSO_API=PLUGINS["ISSO"]["api"], ) #初始化插件管理器(自动扫描并加载运行) plugin_packages = [] if PLUGINS["Valine"]["enable"] in ("true", True, "True"): plugin_packages.append("flask_pluginkit_valine") if PLUGINS["ISSO"]["enable"] in ("true", True, "True"): plugin_packages.append("flask_pluginkit_isso") plugin = PluginManager(app, logger=logger.plugin, stpl=True,
from flask_pluginkit import PluginManager, blueprint, Flask from ui import ui_blueprint from apis.core import core_blueprint from libs.Node import NodeManager from libs.Swarm import MultiSwarmManager from libs.Service import ServiceManager from libs.Network import NetworkManager from libs.Registry import RegistryManager __author__ = 'staugur' __email__ = '*****@*****.**' __doc__ = 'Manage swarm clusters to provide a more concise and compact intermediate layer web application with ui.' # 初始化定义application app = Flask(__name__) app.config.update( SECRET_KEY=os.urandom(24), PLUGINKIT_AUTHMETHOD="BOOL", PLUGINKIT_GUNICORN_ENABLED=True, PLUGINKIT_GUNICORN_PROCESSNAME="gunicorn: master [{}]".format(GLOBAL["ProcessName"]) ) # 初始化插件管理器(自动扫描并加载运行) plugin = PluginManager(app, logger=plugin_logger) # 注册视图包中蓝图 app.register_blueprint(FrontBlueprint) app.register_blueprint(ui_blueprint, url_prefix="/ui") app.register_blueprint(core_blueprint, url_prefix="/api")
import rq_scheduler_dashboard from config import GLOBAL, SSO, REDIS from version import __version__ from utils.tool import err_logger, access_logger, plugin_logger from utils.web import verify_sessionId, analysis_sessionId, get_redirect_url, get_userinfo from views import FrontBlueprint from flask import request, g, jsonify from flask_pluginkit import Flask, PluginManager __author__ = 'staugur' __email__ = '*****@*****.**' __doc__ = '基于Inception,一个审计、执行、回滚、统计sql的开源系统' __date__ = '2018-08-08' # 初始化定义application app = Flask(__name__) app.config.update( SECRET_KEY=os.urandom(24), REDIS_URL=REDIS, RQ_POLL_INTERVAL=2500, ) # 初始化插件管理器(自动扫描并加载运行) plugin = PluginManager(app, logger=plugin_logger) # 注册视图包中蓝图 app.register_blueprint(FrontBlueprint) app.register_blueprint(rq_dashboard.blueprint, url_prefix="/rqdashboard") app.register_blueprint(rq_scheduler_dashboard.blueprint, url_prefix="/rqschedulerdashboard")
Comments: http://flask.pocoo.org/docs/0.10/styleguide/#comments :copyright: (c) 2018 by staugur. :license: MIT, see LICENSE for more details. """ from flask import g, render_template, render_template_string from flask_pluginkit import Flask, PluginManager, blueprint, push_dcp __author__ = 'staugur' __email__ = '*****@*****.**' __doc__ = 'An example for Flask-PluginKit' # 初始化定义application app = Flask(__name__) #app.config["PLUGINKIT_AUTHMETHOD"] = "BOOL" app.config["PLUGINKIT_AUTHMETHOD"] = "BASIC" app.config["PLUGINKIT_AUTHREALM"] = "Flask-PluginKit Welcome" app.config["PLUGINKIT_AUTHUSERS"] = dict(admin="admin") # 初始化插件管理器(自动扫描并加载运行) plugin = PluginManager(app, s3="local") # 注册flask-pluginkit的蓝图 app.register_blueprint(blueprint, url_prefix="/PluginManager") @app.before_request_top def br(): g.signin = True
from flask_pluginkit import Flask as FixFlask, PluginManager, blueprint, LocalStorage, PY2, push_dcp, DCPError from jinja2 import Markup # app1 with flask-pluginkit app1 = Flask("app1") app1.config['TESTING'] = True PluginManager(app1, s3="local") app1.register_blueprint(blueprint) # app2 without flask-pluginkit app2 = Flask("app2") app2.config['TESTING'] = True app2.register_blueprint(blueprint) # app3 with fixflask app3 = FixFlask("app3") app3.config['TESTING'] = True def callback(): return "test" class PMTest(unittest.TestCase): def setUp(self): self.c1 = app1.test_client() self.c2 = app2.test_client() def api2dict(self, res): if PY2: return json.loads(res)
import os from config import GLOBAL from version import __version__ from utils.tool import err_logger, access_logger, plugin_logger from utils.web import verify_sessionId, analysis_sessionId, get_redirect_url, get_userinfo from views import FrontBlueprint from flask import request, g, jsonify from flask_pluginkit import PluginManager, blueprint, Flask __author__ = 'staugur' __email__ = '*****@*****.**' __doc__ = 'xxx' __date__ = 'xxx' # 初始化定义application app = Flask(__name__) app.config.update( SECRET_KEY=os.urandom(24), PLUGINKIT_AUTHMETHOD="BOOL", PLUGINKIT_GUNICORN_ENABLED=True, PLUGINKIT_GUNICORN_PROCESSNAME="gunicorn: master [{}]".format( GLOBAL["ProcessName"])) # 初始化插件管理器(自动扫描并加载运行) plugin = PluginManager(app, logger=plugin_logger) # 注册视图包中蓝图 app.register_blueprint(FrontBlueprint) app.register_blueprint(blueprint, url_prefix="/PluginManager")
from utils.tool import logger, err_logger, access_logger, create_redis_engine, create_mysql_engine, DO from utils.web import verify_sessionId, analysis_sessionId, tpl_adminlogin_required, get_redirect_url from hlm import UserAppManager, UserSSOManager, UserMsgManager, UserProfileManager from views import FrontBlueprint, ApiBlueprint from flask import request, g, jsonify from flask_pluginkit import Flask, PluginManager reload(sys) sys.setdefaultencoding('utf-8') __author__ = 'staugur' __email__ = '*****@*****.**' __doc__ = '统一认证与单点登录系统' __date__ = '2018-01-09' # 初始化定义application app = Flask(__name__) app.config.update(SECRET_KEY=os.urandom(24), MAX_CONTENT_LENGTH=4 * 1024 * 1024) # 初始化接口管理器 api = DO({ "userapp": UserAppManager(), "usersso": UserSSOManager(), "usermsg": UserMsgManager(), "userprofile": UserProfileManager(), }) # 初始化插件管理器(自动扫描并加载运行) plugin = PluginManager(app) # 注册视图包中蓝图
import jinja2 from config import GLOBAL, SSO from version import __version__ from utils.tool import err_logger, access_logger, plugin_logger from utils.web import verify_sessionId, analysis_sessionId, get_redirect_url, get_userinfo from views import FrontBlueprint from flask import request, g, jsonify from flask_pluginkit import Flask, PluginManager __author__ = 'staugur' __email__ = '*****@*****.**' __doc__ = '基于Inception,一个审计、执行、回滚、统计sql的开源系统' __date__ = '2018-08-08' # 初始化定义application app = Flask(__name__) app.config.update(SECRET_KEY=os.urandom(24)) # 初始化插件管理器(自动扫描并加载运行) plugin = PluginManager(app, logger=plugin_logger) # 注册视图包中蓝图 app.register_blueprint(FrontBlueprint) # 添加模板上下文变量 @app.context_processor def GlobalTemplateVariables(): data = { "Version": __version__, "Author": __author__,