changeset 894:ca357249a321

admin: Read an optional Flask-app configuration file.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 02 Jul 2017 22:21:24 -0700
parents 14cca285f73b
children accfe8fc8440
files piecrust/admin/web.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/admin/web.py	Sun Jul 02 22:20:48 2017 -0700
+++ b/piecrust/admin/web.py	Sun Jul 02 22:21:24 2017 -0700
@@ -12,12 +12,15 @@
 
     app = Flask(__name__.split('.')[0], static_folder=None)
     app.config.from_object('piecrust.admin.settings')
-    app.config.from_envvar('FOODTRUCK_SETTINGS', silent=True)
     if extra_settings:
         app.config.update(extra_settings)
 
     root_dir = app.config.setdefault('FOODTRUCK_ROOT', os.getcwd())
 
+    app.config.from_pyfile(os.path.join(root_dir, 'admin_app.cfg'),
+                           silent=True)
+    app.config.from_envvar('FOODTRUCK_SETTINGS', silent=True)
+
     # Add a special route for the `.well-known` directory.
     app.wsgi_app = SharedDataMiddleware(
         app.wsgi_app,