当前位置: 首页>>代码示例>>Python>>正文


Python Flask.__init__方法代码示例

本文整理汇总了Python中flask.Flask.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Flask.__init__方法的具体用法?Python Flask.__init__怎么用?Python Flask.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask.Flask的用法示例。


在下文中一共展示了Flask.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import __init__ [as 别名]
def __init__(
        self,
        import_name
    ):
        Flask.__init__(
            self,
            import_name,
            static_folder='./static',
            template_folder='./templates'
        )
        # set config
        app_settings = os.getenv('APP_SETTINGS')
        self.config.from_object(app_settings)

        # configure logging
        handler = logging.FileHandler(self.config['LOGGING_LOCATION'])
        handler.setLevel(self.config['LOGGING_LEVEL'])
        handler.setFormatter(logging.Formatter(self.config['LOGGING_FORMAT']))
        self.logger.addHandler(handler)

        # enable CORS
        CORS(self) 
开发者ID:mtnbarreto,项目名称:flask-base-api,代码行数:24,代码来源:base_definitions.py

示例2: __init__

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import __init__ [as 别名]
def __init__(self, signing_secret, endpoint, emitter, server):
        self.signing_secret = signing_secret
        self.emitter = emitter
        self.endpoint = endpoint
        self.package_info = self.get_package_info()

        # If a server is passed in, bind the event handler routes to it,
        # otherwise create a new Flask instance.
        if server:
            if isinstance(server, (Flask, Blueprint, LocalProxy)):
                self.bind_route(server)
            else:
                raise TypeError("Server must be an instance of Flask, Blueprint, or LocalProxy")
        else:
            Flask.__init__(self, __name__)
            self.bind_route(self) 
开发者ID:slackapi,项目名称:python-slack-events-api,代码行数:18,代码来源:server.py

示例3: __init__

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import __init__ [as 别名]
def __init__(self, import_name):
        Flask.__init__(self, import_name=import_name)
        self.args = {}
        self.dictionary = None
        self.cameraParameters = None
        self.markerDetector = None

        with open(opjoin(opdirname(opabspath(__file__)), 'templates/index.tpl')) as f:
            self.template_string = f.read()

        self.js_libs = {}
        static_js_path = opjoin(opdirname(opabspath(__file__)), 'static/js')
        for filename in {'three.min.js', 'MTLLoader.js', 'OBJLoader.js', 'barviews.js'}:
            with open(opjoin(static_js_path, filename)) as f:
                self.js_libs[filename] = open(opjoin(static_js_path, filename)).read() 
开发者ID:bxtkezhan,项目名称:BAR4Py,代码行数:17,代码来源:web.py

示例4: __init__

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import __init__ [as 别名]
def __init__(self, *args, **kwargs):
        """Overriden Jinja constructor setting a custom jinja_environment"""
        self.jinja_environment = SandboxedBaseEnvironment
        self.session_interface = CachingSessionInterface(key_prefix="session")
        self.request_class = CTFdRequest

        # Store server start time
        self.start_time = datetime.datetime.utcnow()

        # Create generally unique run identifier
        self.run_id = sha256(str(self.start_time))[0:8]
        Flask.__init__(self, *args, **kwargs) 
开发者ID:CTFd,项目名称:CTFd,代码行数:14,代码来源:__init__.py

示例5: __init__

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import __init__ [as 别名]
def __init__(self, name, *args, **kwargs):
        Flask.__init__(self, name, *args, **kwargs)

        # Is set on later initialization
        self.api = None  # type: ServerAPI 
开发者ID:ActivityWatch,项目名称:aw-server,代码行数:7,代码来源:server.py


注:本文中的flask.Flask.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。