From: Bret Taylor Date: Fri, 18 Sep 2009 02:47:32 +0000 (-0700) Subject: Turn on auto-reloading when 'debug' setting is given X-Git-Tag: v1.0.0~108 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11503326a6ed78907aee462fc07ef0b9cdb0c8a2;p=thirdparty%2Ftornado.git Turn on auto-reloading when 'debug' setting is given --- diff --git a/demos/auth/authdemo.py b/demos/auth/authdemo.py index 2a309f384..e6136d1b5 100755 --- a/demos/auth/authdemo.py +++ b/demos/auth/authdemo.py @@ -35,8 +35,6 @@ class Application(tornado.web.Application): 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) diff --git a/tornado/autoreload.py b/tornado/autoreload.py index e644023c4..583cdc96f 100644 --- a/tornado/autoreload.py +++ b/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 diff --git a/tornado/web.py b/tornado/web.py index a625e7838..08047a4e3 100644 --- a/tornado/web.py +++ b/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 @@ class Application(object): 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 @@ class Application(object): 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() diff --git a/tornado/wsgi.py b/tornado/wsgi.py index 76a032fe7..1dd02298e 100644 --- a/tornado/wsgi.py +++ b/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))