mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Adds a way to (re)configure the running app, reloading settings.
Currently, there is no way to reset settings after modifying them, which is anoying for tests.
This commit is contained in:
parent
0e21449191
commit
d6c514e7d1
1 changed files with 18 additions and 11 deletions
|
@ -9,10 +9,15 @@ from api import api
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config.from_object("default_settings")
|
|
||||||
|
|
||||||
# Deprecations
|
|
||||||
if 'DEFAULT_MAIL_SENDER' in app.config:
|
def configure():
|
||||||
|
""" A way to (re)configure the app, specially reset the settings
|
||||||
|
"""
|
||||||
|
app.config.from_object("default_settings")
|
||||||
|
|
||||||
|
# Deprecations
|
||||||
|
if 'DEFAULT_MAIL_SENDER' in app.config:
|
||||||
# Since flask-mail 0.8
|
# Since flask-mail 0.8
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"DEFAULT_MAIL_SENDER is deprecated in favor of MAIL_DEFAULT_SENDER"
|
"DEFAULT_MAIL_SENDER is deprecated in favor of MAIL_DEFAULT_SENDER"
|
||||||
|
@ -22,6 +27,8 @@ if 'DEFAULT_MAIL_SENDER' in app.config:
|
||||||
if not 'MAIL_DEFAULT_SENDER' in app.config:
|
if not 'MAIL_DEFAULT_SENDER' in app.config:
|
||||||
app.config['MAIL_DEFAULT_SENDER'] = DEFAULT_MAIL_SENDER
|
app.config['MAIL_DEFAULT_SENDER'] = DEFAULT_MAIL_SENDER
|
||||||
|
|
||||||
|
configure()
|
||||||
|
|
||||||
|
|
||||||
app.register_blueprint(main)
|
app.register_blueprint(main)
|
||||||
app.register_blueprint(api)
|
app.register_blueprint(api)
|
||||||
|
|
Loading…
Reference in a new issue