本文整理汇总了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)
示例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)
示例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()
示例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)
示例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