當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。