From 15ca4939a484cb14cdc8a5f637abd21d3a15dcb6 Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Fri, 11 Sep 2015 11:58:21 +0200
Subject: [PATCH] Using the Werkzeug reloader is configurable

The Werkzeug reloader is disabled by default due to a bug with
using it in combination with `python -m mutalyzer.entrypoints.website`.

https://github.com/mitsuhiko/werkzeug/issues/461#issuecomment-139369694
---
 doc/config.rst                       | 10 ++++++++++
 mutalyzer/config/default_settings.py |  6 ++++++
 mutalyzer/entrypoints/website.py     |  3 ++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/config.rst b/doc/config.rst
index cd8ebf97..bb7d27e4 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -246,3 +246,13 @@ NEGATIVE_PROTEIN_LINK_EXPIRATION
   (in seconds).
 
   `Default value:` `60 * 60 * 24 * 5` (5 days)
+
+USE_RELOADER
+  Enable the `Werkzeug reloader
+  <http://werkzeug.pocoo.org/docs/0.10/serving/#reloader>`_ for the website.
+
+  This is disabled by default due to `a bug with using the reloader
+  <https://github.com/mitsuhiko/werkzeug/issues/461#issuecomment-139369694>`_
+  in combination with ``python -m mutalyzer.entrypoints.website``.
+
+  `Default value:` `False`
diff --git a/mutalyzer/config/default_settings.py b/mutalyzer/config/default_settings.py
index 84c2373e..f985e8ce 100644
--- a/mutalyzer/config/default_settings.py
+++ b/mutalyzer/config/default_settings.py
@@ -88,3 +88,9 @@ PIWIK_BASE_URL = 'https://piwik.example.com'
 
 # Piwik site ID for Mutalyzer.
 PIWIK_SITE_ID = 1
+
+# Enable the Werkzeug reloader for the website.
+# This is disabled by default due to a bug with using the reloader in
+# combination with `python -m mutalyzer.entrypoints.website`.
+# https://github.com/mitsuhiko/werkzeug/issues/461#issuecomment-139369694
+USE_RELOADER = False
diff --git a/mutalyzer/entrypoints/website.py b/mutalyzer/entrypoints/website.py
index 48ca96f0..7e8a2f8f 100644
--- a/mutalyzer/entrypoints/website.py
+++ b/mutalyzer/entrypoints/website.py
@@ -59,7 +59,8 @@ def debugserver(host, port):
     """
     Run the website with the Python built-in HTTP server.
     """
-    application.run(host=host, port=port, debug=True, use_reloader=True)
+    application.run(host=host, port=port, debug=True,
+                    use_reloader=settings.USE_RELOADER)
 
 
 def main():
-- 
GitLab