@@ -971,26 +971,40 @@ Debug mode and automatic reloading
971
971
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
972
972
973
973
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.
980
986
981
987
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.
984
990
985
991
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.
988
997
989
998
Reloading loses any Python interpreter command-line arguments (e.g. ``-u ``)
990
999
because it re-executes Python using ``sys.executable `` and ``sys.argv ``.
991
1000
Additionally, modifying these variables will cause reloading to behave
992
1001
incorrectly.
993
1002
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
+
994
1008
995
1009
Running Tornado in production
996
1010
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments