summaryrefslogtreecommitdiff
path: root/docs/narr/project.rst
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2016-12-13 13:13:47 -0800
committerSteve Piercy <web@stevepiercy.com>2016-12-13 13:13:47 -0800
commit9bbed79e04378d6534c07d73ab801191f0489e88 (patch)
tree6ec01ee3cb5389cd0cbe8234280bf4408123659d /docs/narr/project.rst
parent4393f8b8e54e636b5655e0a8d2477e0b15820f68 (diff)
parent884bcdc628e7144abf8e1cd1cde1ed3019e7e699 (diff)
downloadpyramid-9bbed79e04378d6534c07d73ab801191f0489e88.tar.gz
pyramid-9bbed79e04378d6534c07d73ab801191f0489e88.tar.bz2
pyramid-9bbed79e04378d6534c07d73ab801191f0489e88.zip
Merge remote-tracking branch 'upstream/pcreate-to-cookiecutter' into pcreate-to-cookiecutter
Diffstat (limited to 'docs/narr/project.rst')
-rw-r--r--docs/narr/project.rst42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 71bd176f6..77c637571 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -1045,3 +1045,45 @@ Another good production alternative is :term:`Green Unicorn` (aka
mod_wsgi, although it depends, in its default configuration, on having a
buffering HTTP proxy in front of it. It does not, as of this writing, work on
Windows.
+
+Automatically Reloading Your Code
+---------------------------------
+
+During development, it can be really useful to automatically have the
+webserver restart when you make changes. ``pserve`` has a ``--reload`` switch
+to enable this. It uses the
+`hupper <http://docs.pylonsproject.org/projects/hupper/en/latest/>` package
+to enable this behavior. When your code crashes, ``hupper`` will wait for
+another change or the ``SIGHUP`` signal before restarting again.
+
+inotify support
+~~~~~~~~~~~~~~~
+
+By default, ``hupper`` will poll the filesystem for changes to all python
+code. This can be pretty inefficient in larger projects. To be nicer to your
+hard drive, you should install the
+`watchdog <http://pythonhosted.org/watchdog/>` package in development.
+``hupper`` will automatically use ``watchdog`` to more efficiently poll the
+filesystem.
+
+Monitoring Custom Files
+~~~~~~~~~~~~~~~~~~~~~~~
+
+By default, ``pserve --reload`` will monitor all imported Python code
+(everything in ``sys.modules``) as well as the config file passed to
+``pserve`` (e.g. ``development.ini``). You can instruct ``pserve`` to watch
+other files for changes as well by defining a ``[pserve]`` section in your
+configuration file. For example, let's say your application loads the
+``favicon.ico`` file at startup and stores it in memory to efficiently
+serve it many times. When you change it you want ``pserve`` to restart:
+
+.. code-block:: ini
+
+ [pserve]
+ watch_files =
+ myapp/static/favicon.ico
+
+Paths may be absolute or relative to the configuration file. They may also
+be an :term:`asset specification`. These paths are passed to ``hupper`` which
+has some basic support for globbing. Acceptable glob patterns depend on the
+version of Python being used.