Skip to content

Commit f229efb

Browse files
committed
Update debug mode docs.
1 parent 5b3e9ec commit f229efb

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

docs/overview.rst

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -971,26 +971,40 @@ Debug mode and automatic reloading
971971
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
972972

973973
If you pass ``debug=True`` to the ``Application`` constructor, the app
974-
will be run in debug mode. In this mode, templates will not be cached
975-
and the app will watch for changes to its source files and reload itself
976-
when anything changes. This reduces the need to manually restart the
977-
server during development. However, certain failures (such as syntax
978-
errors at import time) can still take the server down in a way that
979-
debug mode cannot currently recover from.
974+
will be run in debug/development mode. In this mode, several features
975+
intended for convenience while developing will be enabled:
976+
977+
* The app will watch for changes to its source files and reload itself
978+
when anything changes. This reduces the need to manually restart the
979+
server during development. However, certain failures (such as syntax
980+
errors at import time) can still take the server down in a way that
981+
debug mode cannot currently recover from.
982+
* Templates will not be cached, nor will static file hashes (used by the
983+
``static_url`` function)
984+
* When an exception in a ``RequestHandler`` is not caught, an error
985+
page including a stack trace will be generated.
980986

981987
Debug mode is not compatible with ``HTTPServer``'s multi-process mode.
982-
You must not give ``HTTPServer.start`` an argument greater than 1 if you
983-
are using debug mode.
988+
You must not give ``HTTPServer.start`` an argument other than 1 (or
989+
call `tornado.process.fork_processes`) if you are using debug mode.
984990

985991
The automatic reloading feature of debug mode is available as a
986-
standalone module in ``tornado.autoreload``, and is optionally used by
987-
the test runner in ``tornado.testing.main``.
992+
standalone module in ``tornado.autoreload``. The two can be used in
993+
combination to provide extra robustness against syntax errors: set
994+
``debug=True`` within the app to detect changes while it is running,
995+
and start it with ``python -m tornado.autoreload myserver.py`` to catch
996+
any syntax errors or other errors at startup.
988997

989998
Reloading loses any Python interpreter command-line arguments (e.g. ``-u``)
990999
because it re-executes Python using ``sys.executable`` and ``sys.argv``.
9911000
Additionally, modifying these variables will cause reloading to behave
9921001
incorrectly.
9931002

1003+
On some platforms (including Windows and Mac OSX prior to 10.6), the
1004+
process cannot be updated "in-place", so when a code change is
1005+
detected the old server exits and a new one starts. This has been
1006+
known to confuse some IDEs.
1007+
9941008

9951009
Running Tornado in production
9961010
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)