changeset 376:21687b933193

serve: Add a WSGI utility module for easily getting a default app. This makes it easy to run Gunicorn from the command-line using the Gunicorn script instead of the `chef serve` command.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 07 May 2015 22:47:44 -0700
parents aade4ea57e7f
children b45322924d18
files piecrust/wsgiutil/__init__.py piecrust/wsgiutil/cwdapp.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piecrust/wsgiutil/cwdapp.py	Thu May 07 22:47:44 2015 -0700
@@ -0,0 +1,11 @@
+# This is a utility module that can be used with any WSGI-compatible server
+# like Werkzeug or Gunicorn. It returns a WSGI app for serving a PieCrust
+# website located in the current working directory.
+import os
+from piecrust.serving.server import Server
+
+
+root_dir = os.getcwd()
+server = Server(root_dir, sub_cache_dir='prod', enable_debug_info=False)
+app = server.getWsgiApp()
+