Skip to content

Commit

Permalink
Update docs and other tweaks
Browse files Browse the repository at this point in the history
* Add kezabelle to contributors
* Fix `make docs` command
* Update docs
  * Custom checks
  * How to run a subset of checks
  * New Default checks section
  * Check in modules and watchman sections
  • Loading branch information
mwarkentin committed Aug 30, 2014
1 parent c354c36 commit 2d41c4b
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 4 deletions.
4 changes: 2 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Credits
Development Lead
----------------

* Michael Warkentin <[email protected]>
* Michael Warkentin <[email protected]> - https://github.com/mwarkentin

Contributors
------------

None yet. Why not be the first?
* Keryn Knight - https://github.com/kezabelle
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ coverage:
open htmlcov/index.html

docs:
rm -f docs/django-watchman.rst
rm -f docs/watchman.rst
rm -f docs/modules.rst
sphinx-apidoc -o docs/ django-watchman
sphinx-apidoc -o docs/ watchman
$(MAKE) -C docs clean
$(MAKE) -C docs html
open docs/_build/html/index.html
Expand Down
36 changes: 36 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,39 @@ The value of this setting will be the **GET** parameter that you must pass in::
WATCHMAN_TOKEN_NAME = 'custom-token-name'

GET http://127.0.0.1:8000/watchman/?custom-token-name=:token

Custom checks
*************

django-watchman allows you to customize the checks which are run by modifying
the ``WATCHMAN_CHECKS`` setting. In ``settings.py``::

WATCHMAN_CHECKS = (
'module.path.to.callable',
'another.module.path.to.callable',
)

Checks now have the same contract as context processors: they consume a
``request`` and return a ``dict`` whose keys are applied to the JSON response::

def my_check(request):
return {'x': 1}

In the absence of any checks, a 404 is thrown, which is then handled by the
``json_view`` decorator.

Run a subset of available checks
********************************

A subset of checks may be run, by passing ``?check=module.path.to.callable&check=...``
in the request URL. Only the callables given in querystring, which are in the
``WATCHMAN_CHECKS`` should be run, eg::

curl -XGET http://127.0.0.1:8080/watchman/?check=watchman.views.caches_status

Default checks
--------------

By default, django-watchman will run checks against your databases
(``watchman.views.databases_status``) and caches (``watchman.views.caches_status``).
These will function even if you haven't configured the respective settings.
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
watchman
========

.. toctree::
:maxdepth: 4

watchman
70 changes: 70 additions & 0 deletions docs/watchman.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
watchman package
================

Submodules
----------

watchman.checks module
----------------------

.. automodule:: watchman.checks
:members:
:undoc-members:
:show-inheritance:

watchman.decorators module
--------------------------

.. automodule:: watchman.decorators
:members:
:undoc-members:
:show-inheritance:

watchman.models module
----------------------

.. automodule:: watchman.models
:members:
:undoc-members:
:show-inheritance:

watchman.settings module
------------------------

.. automodule:: watchman.settings
:members:
:undoc-members:
:show-inheritance:

watchman.urls module
--------------------

.. automodule:: watchman.urls
:members:
:undoc-members:
:show-inheritance:

watchman.utils module
---------------------

.. automodule:: watchman.utils
:members:
:undoc-members:
:show-inheritance:

watchman.views module
---------------------

.. automodule:: watchman.views
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: watchman
:members:
:undoc-members:
:show-inheritance:

0 comments on commit 2d41c4b

Please sign in to comment.