Browse files

Turn on auto-reloading when 'debug' setting is given

  • Loading branch information...
1 parent c4f682d commit 11503326a6ed78907aee462fc07ef0b9cdb0c8a2 @finiteloop finiteloop committed Sep 18, 2009
Showing with 9 additions and 8 deletions.
  1. +0 −2 demos/auth/authdemo.py
  2. +5 −1 tornado/autoreload.py
  3. +3 −3 tornado/web.py
  4. +1 −2 tornado/wsgi.py
View
2 demos/auth/authdemo.py
@@ -35,8 +35,6 @@ def __init__(self):
settings = dict(
cookie_secret="32oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
login_url="/auth/login",
- google_consumer_key="www.tornadoweb.org",
- google_consumer_secret="ZcyJGvEEFn82+h9/PWgBeB0E",
)
tornado.web.Application.__init__(self, handlers, **settings)
View
6 tornado/autoreload.py
@@ -14,7 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""A module to automatically restart the server when a module is modified."""
+"""A module to automatically restart the server when a module is modified.
+
+This module depends on IOLoop, so it will not work in WSGI applications
+and Google AppEngine.
+"""
import functools
import ioloop
View
6 tornado/web.py
@@ -854,7 +854,7 @@ class Application(object):
and we will serve /favicon.ico and /robots.txt from the same directory.
"""
def __init__(self, handlers=None, default_host="", transforms=None,
- **settings):
+ wsgi=False, **settings):
if transforms is None:
self.transforms = [ChunkedTransferEncoding]
else:
@@ -864,7 +864,7 @@ def __init__(self, handlers=None, default_host="", transforms=None,
self.settings = settings
self.ui_modules = {}
self.ui_methods = {}
- self._wsgi = False
+ self._wsgi = wsgi
self._load_ui_modules(settings.get("ui_modules", {}))
self._load_ui_methods(settings.get("ui_methods", {}))
if self.settings.get("static_path"):
@@ -878,7 +878,7 @@ def __init__(self, handlers=None, default_host="", transforms=None,
if handlers: self.add_handlers(".*$", handlers)
# Automatically reload modified modules
- if self.settings.get("auto_reload"):
+ if self.settings.get("debug") and not wsgi:
import autoreload
autoreload.start()
View
3 tornado/wsgi.py
@@ -69,8 +69,7 @@ class WSGIApplication(web.Application):
"""
def __init__(self, handlers=None, default_host="", **settings):
web.Application.__init__(self, handlers, default_host, transforms=[],
- **settings)
- self._wsgi = True
+ wsgi=True, **settings)
def __call__(self, environ, start_response):
handler = web.Application.__call__(self, HTTPRequest(environ))

0 comments on commit 1150332

Please sign in to comment.