Skip to content

Commit

Permalink
Merge pull request #17 from patoroco/add_settings_to_the_docs
Browse files Browse the repository at this point in the history
Adding a small paragraph about configuration in the README
  • Loading branch information
wolph committed Jul 12, 2019
2 parents aef8b7f + bc688d4 commit 6eb46ca
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ and view durations to statsd.
- http://django-stats.readthedocs.org/en/latest/
* Source
- https://github.com/WoLpH/django-statsd
* Bug reports
* Bug reports
- https://github.com/WoLpH/django-statsd/issues
* Package homepage
- https://pypi.python.org/pypi/django-statsd
* Python Statsd
- https://github.com/WoLpH/python-statsd
* Graphite
- http://graphite.wikidot.com
* Statsd
* Statsd
- code: https://github.com/etsy/statsd
- blog post: http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/

Expand All @@ -34,21 +34,33 @@ Usage
To install, add the following to your ``settings.py``:

1. ``django_statsd`` to the ``INSTALLED_APPS`` setting.
2. ``django_statsd.middleware.StatsdMiddleware`` to the **top** of your
2. ``django_statsd.middleware.StatsdMiddleware`` to the **top** of your
``MIDDLEWARE_CLASSES``
3. ``django_statsd.middleware.StatsdMiddlewareTimer`` to the **bottom** of your
3. ``django_statsd.middleware.StatsdMiddlewareTimer`` to the **bottom** of your
``MIDDLEWARE_CLASSES``

Configuration
-------------
You can configure ``django-statsd`` using the Django settings config:

>>> # Settings
... STATSD_HOST = '127.0.0.1'
... STATSD_PORT = 12345

The full list of configurations is available in ReadTheDocs_.

.. _ReadTheDocs: https://django-stats.readthedocs.io/en/latest/django_statsd.html#module-django_statsd.settings


Advanced Usage
--------------

>>> def some_view(request):
... with request.timings('something_to_time'):
... # do something here
... pass
>>>
>>>
>>> def some_view(request):
... request.timings.start('something_to_time')
... # do something here
... request.timings.stop('something_to_time')

0 comments on commit 6eb46ca

Please sign in to comment.