Skip to content

Commit

Permalink
Turn on auto-reloading when 'debug' setting is given
Browse files Browse the repository at this point in the history
  • Loading branch information
finiteloop committed Sep 18, 2009
1 parent c4f682d commit 1150332
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions demos/auth/authdemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 5 additions & 1 deletion tornado/autoreload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tornado/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"):
Expand All @@ -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()

Expand Down
3 changes: 1 addition & 2 deletions tornado/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1150332

Please sign in to comment.