本文整理汇总了Python中flask_sslify.SSLify方法的典型用法代码示例。如果您正苦于以下问题:Python flask_sslify.SSLify方法的具体用法?Python flask_sslify.SSLify怎么用?Python flask_sslify.SSLify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_sslify
的用法示例。
在下文中一共展示了flask_sslify.SSLify方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_object=ProdConfig):
"""An application factory, as explained here:
http://flask.pocoo.org/docs/patterns/appfactories/
:param config_object: The configuration object to use.
"""
app = Flask(__name__)
sslify = SSLify(app)
# set config from the passed object
app.config.from_object(config_object)
# set additional config values from environ
app.config['SLACK_WEBHOOK_URL'] = os.environ.get('SLACK_WEBHOOK_URL')
register_extensions(app)
register_blueprints(app)
register_errorhandlers(app)
register_template_globals(app)
@app.before_first_request
def before_first_request():
register_logging(app)
return app
示例2: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
bootstrap.init_app(app)
mail.init_app(app)
moment.init_app(app)
db.init_app(app)
login_manager.init_app(app)
pagedown.init_app(app)
if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
from flask_sslify import SSLify
sslify = SSLify(app)
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
from .auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint, url_prefix='/auth')
return app
示例3: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
db.init_app(app)
if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
from flask_sslify import SSLify
sslify = SSLify(app)
from .main.views import main as main_blueprint
app.register_blueprint(main_blueprint)
from .main.api import api as api_blueprint
app.register_blueprint(api_blueprint, url_prefix='/api')
return app
示例4: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(Config)
app.context_processor(inject_app_context)
for _ext in _extensions:
_ext.init_app(app)
for _bp in _blueprints:
app.register_blueprint(_bp)
# only trigger SSLify if the app is running on Heroku
if "DYNO" in os.environ:
from flask_sslify import SSLify
_ = SSLify(app)
return app
示例5: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config):
app = Flask(__name__)
app.config.from_object(config)
config.init_app(app)
db.init_app(app)
login_manager.init_app(app)
csrf.init_app(app)
db.app = app
if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
from flask_sslify import SSLify
sslify = SSLify(app)
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
return app
示例6: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
bootstrap.init_app(app)
mail.init_app(app)
moment.init_app(app)
db.init_app(app)
login_manager.init_app(app)
pagedown.init_app(app)
if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
from flask_sslify import SSLify
sslify = SSLify(app)
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
from .auth import auth as auth_blueprint
app.register_blueprint(auth_blueprint, url_prefix='/auth')
from .api_1_0 import api as api_1_0_blueprint
app.register_blueprint(api_1_0_blueprint, url_prefix='/api/v1.0')
return app
示例7: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
# config[config_name].init_app(app)
moment.init_app(app)
db.init_app(app)
lm.init_app(app)
mail.init_app(app)
pagedown.init_app(app)
whooshee.init_app(app)
if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
from flask_sslify import SSLify
sslify = SSLify(app)
from .user import user as user_blueprint
from .auth import auth as auth_blueprint
from .admin import admin as admin_blueprint
from .message import message as message_blueprint
from .api_1_0 import api as api_1_0_blueprint
app.register_blueprint(user_blueprint)
app.register_blueprint(auth_blueprint, url_prefix='/auth')
app.register_blueprint(admin_blueprint, url_prefix='/admin')
app.register_blueprint(message_blueprint, url_prefix='/message')
app.register_blueprint(api_1_0_blueprint, url_prefix='/api/v1.0')
return app
示例8: init_https
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def init_https(app):
# only trigger SSLify if the app is running on Heroku and debug is false
if (app.config['DEBUG'] is False) and ('DYNO' in os.environ):
from flask_sslify import SSLify
SSLify(app)
示例9: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
login_manager.init_app(app)
# mail.init_app(app)
# app.config["MAIL"] = mail
scheduler.init_app(app)
scheduler.start()
# for blueprints
from .blueprints import routes as routes_blueprint
app.register_blueprint(routes_blueprint)
from .api import api_bp as api_blueprint
app.register_blueprint(api_blueprint, url_prefix='/api/v1')
if app.config['SSL_REDIRECT']:
from flask_sslify import SSLify
sslify = SSLify(app)
return app
示例10: create_app
# 需要导入模块: import flask_sslify [as 别名]
# 或者: from flask_sslify import SSLify [as 别名]
def create_app():
app = Flask(__name__)
mail = Mail(app)
if SSL:
sslify = SSLify(app)
from personal_mycroft_backend.utils import nice_json
from personal_mycroft_backend.backend.decorators import noindex
from personal_mycroft_backend.backend.auth import get_auth_routes
from personal_mycroft_backend.backend.device import get_device_routes
from personal_mycroft_backend.backend.stt import get_stt_routes
from personal_mycroft_backend.backend.tts import get_tts_routes
app = get_auth_routes(app)
app = get_device_routes(app, mail)
app = get_stt_routes(app)
app = get_tts_routes(app)
@app.route("/", methods=['GET'])
@noindex
def hello():
return nice_json({
"uri": "/",
"welcome to Personal Mycroft Backend": {
"author": "JarbasAI"
}
})
return app