本文整理匯總了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