Update debug mode docs.
This commit is contained in:
parent
5b3e9ec4a3
commit
f229efbf06
|
@ -971,26 +971,40 @@ Debug mode and automatic reloading
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
If you pass ``debug=True`` to the ``Application`` constructor, the app
|
If you pass ``debug=True`` to the ``Application`` constructor, the app
|
||||||
will be run in debug mode. In this mode, templates will not be cached
|
will be run in debug/development mode. In this mode, several features
|
||||||
and the app will watch for changes to its source files and reload itself
|
intended for convenience while developing will be enabled:
|
||||||
when anything changes. This reduces the need to manually restart the
|
|
||||||
server during development. However, certain failures (such as syntax
|
* The app will watch for changes to its source files and reload itself
|
||||||
errors at import time) can still take the server down in a way that
|
when anything changes. This reduces the need to manually restart the
|
||||||
debug mode cannot currently recover from.
|
server during development. However, certain failures (such as syntax
|
||||||
|
errors at import time) can still take the server down in a way that
|
||||||
|
debug mode cannot currently recover from.
|
||||||
|
* Templates will not be cached, nor will static file hashes (used by the
|
||||||
|
``static_url`` function)
|
||||||
|
* When an exception in a ``RequestHandler`` is not caught, an error
|
||||||
|
page including a stack trace will be generated.
|
||||||
|
|
||||||
Debug mode is not compatible with ``HTTPServer``'s multi-process mode.
|
Debug mode is not compatible with ``HTTPServer``'s multi-process mode.
|
||||||
You must not give ``HTTPServer.start`` an argument greater than 1 if you
|
You must not give ``HTTPServer.start`` an argument other than 1 (or
|
||||||
are using debug mode.
|
call `tornado.process.fork_processes`) if you are using debug mode.
|
||||||
|
|
||||||
The automatic reloading feature of debug mode is available as a
|
The automatic reloading feature of debug mode is available as a
|
||||||
standalone module in ``tornado.autoreload``, and is optionally used by
|
standalone module in ``tornado.autoreload``. The two can be used in
|
||||||
the test runner in ``tornado.testing.main``.
|
combination to provide extra robustness against syntax errors: set
|
||||||
|
``debug=True`` within the app to detect changes while it is running,
|
||||||
|
and start it with ``python -m tornado.autoreload myserver.py`` to catch
|
||||||
|
any syntax errors or other errors at startup.
|
||||||
|
|
||||||
Reloading loses any Python interpreter command-line arguments (e.g. ``-u``)
|
Reloading loses any Python interpreter command-line arguments (e.g. ``-u``)
|
||||||
because it re-executes Python using ``sys.executable`` and ``sys.argv``.
|
because it re-executes Python using ``sys.executable`` and ``sys.argv``.
|
||||||
Additionally, modifying these variables will cause reloading to behave
|
Additionally, modifying these variables will cause reloading to behave
|
||||||
incorrectly.
|
incorrectly.
|
||||||
|
|
||||||
|
On some platforms (including Windows and Mac OSX prior to 10.6), the
|
||||||
|
process cannot be updated "in-place", so when a code change is
|
||||||
|
detected the old server exits and a new one starts. This has been
|
||||||
|
known to confuse some IDEs.
|
||||||
|
|
||||||
|
|
||||||
Running Tornado in production
|
Running Tornado in production
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
Loading…
Reference in New Issue