diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2015-11-09 09:26:11 +0100 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2015-11-09 09:26:11 +0100 |
| commit | a8841f9d3f90ec4c1915493a1b34fa1798895772 (patch) | |
| tree | 665a03e1f5e6b186980a9de8c8abf13b76031135 /budget/run.py | |
| parent | eff0f7c2df4cdbde11f91ca7413af89c3a0606c9 (diff) | |
| parent | 15091e28c070dc0d248b310fe1aa9638de92424a (diff) | |
| download | ihatemoney-mirror-a8841f9d3f90ec4c1915493a1b34fa1798895772.zip ihatemoney-mirror-a8841f9d3f90ec4c1915493a1b34fa1798895772.tar.gz ihatemoney-mirror-a8841f9d3f90ec4c1915493a1b34fa1798895772.tar.bz2 | |
Merge pull request #122 from JocelynDelalande/configurable-prefix
Made an URL prefix configurable in settings
Diffstat (limited to 'budget/run.py')
| -rw-r--r-- | budget/run.py | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/budget/run.py b/budget/run.py index 1a65022..bdb8f46 100644 --- a/budget/run.py +++ b/budget/run.py @@ -6,21 +6,29 @@ from raven.contrib.flask import Sentry from web import main, db, mail from api import api - +from utils import PrefixedWSGI app = Flask(__name__) -app.config.from_object("default_settings") - -# Deprecations -if 'DEFAULT_MAIL_SENDER' in app.config: - # Since flask-mail 0.8 - warnings.warn( - "DEFAULT_MAIL_SENDER is deprecated in favor of MAIL_DEFAULT_SENDER" - +" and will be removed in further version", - UserWarning - ) - if not 'MAIL_DEFAULT_SENDER' in app.config: - app.config['MAIL_DEFAULT_SENDER'] = DEFAULT_MAIL_SENDER + + +def configure(): + """ A way to (re)configure the app, specially reset the settings + """ + app.config.from_object("default_settings") + app.wsgi_app = PrefixedWSGI(app) + + # Deprecations + if 'DEFAULT_MAIL_SENDER' in app.config: + # Since flask-mail 0.8 + warnings.warn( + "DEFAULT_MAIL_SENDER is deprecated in favor of MAIL_DEFAULT_SENDER" + +" and will be removed in further version", + UserWarning + ) + if not 'MAIL_DEFAULT_SENDER' in app.config: + app.config['MAIL_DEFAULT_SENDER'] = DEFAULT_MAIL_SENDER + +configure() app.register_blueprint(main) |
