diff piecrust/serving/util.py @ 575:657384f08ca3

serve: Make it possible to preview pages with a custom root URL.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 19 Dec 2015 18:06:16 -0800
parents daf8df5ade7d
children 3ceeca7bb71c
line wrap: on
line diff
--- a/piecrust/serving/util.py	Sat Dec 19 18:05:28 2015 -0800
+++ b/piecrust/serving/util.py	Sat Dec 19 18:06:16 2015 -0800
@@ -16,11 +16,12 @@
 logger = logging.getLogger(__name__)
 
 
-def get_app_for_server(root_dir, debug=False, sub_cache_dir=None):
+def get_app_for_server(root_dir, debug=False, sub_cache_dir=None,
+                       root_url='/'):
     app = PieCrust(root_dir=root_dir, debug=debug)
     if sub_cache_dir:
         app._useSubCacheDir(sub_cache_dir)
-    app.config.set('site/root', '/')
+    app.config.set('site/root', root_url)
     app.config.set('server/is_serving', True)
     return app