Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 81 lines (53 sloc) 2.546 kb
be07a60 @saulshanabrook initial commit
authored
1 django-response-timeout
2 ============================
3
4 .. image:: https://pypip.in/v/django-response-timeout/badge.png
5 :target: https://crate.io/packages/django-response-timeout
6
7 .. image:: https://travis-ci.org/saulshanabrook/django-response-timeout.png
8 :target: https://travis-ci.org/saulshanabrook/django-response-timeout
9
10 ``django-response-timeout`` allows you to set the cache time globally for
11 all responses. It provides a way to override the client side cache time for
12 the Django `per site`_ caching middleware.
13
14 .. _per site: https://docs.djangoproject.com/en/dev/topics/cache/#the-per-site-cache
15
16
17 Installation
18 ------------
19 Installation is as easy as::
20
21 pip install django-response-timeout
22
23
24 Setup
25 -----
26 Add ``response_timeout.middleware.SetCacheTimeoutMiddleware`` and place it
38f7462 @saulshanabrook Changed dumper middleware to django middleware to reflect independenc…
authored
27 after ``django.middleware.cache.UpdateCacheMiddleware`` so that it will set the
be07a60 @saulshanabrook initial commit
authored
28 header time first on cached responses.
29
30 .. code-block:: python
31
32 MIDDLEWARE_CLASSES = (
33 'django.middleware.cache.UpdateCacheMiddleware',
34 'response_timeout.middleware.SetCacheTimeoutMiddleware',
35 'django.middleware.common.CommonMiddleware',
36 'django.middleware.cache.FetchFromCacheMiddleware',
37 )
38
383e7ae @saulshanabrook forgot double ` around code in readme
authored
39 Then set ``RESPONSE_CACHE_SECONDS`` to the number of seconds each page should
be07a60 @saulshanabrook initial commit
authored
40 be cached on the front end.
41
42 The Django documention does not cohesively describe how your middleware
43 should be ordered, however `this stackoverflow`_ discussion does a fine job.
44
45 .. _this stackoverflow: http://stackoverflow.com/questions/4632323/practical-rules-for-django-middleware-ordering#question
46
47
48 Contributing
49 ------------
50
51 If you find issues or would like to see a feature suppored, head over to
52 the `issues section` and report it. Don't be agraid, go ahead, do it!
53
54 .. _issues section: https://github.com/saulshanabrook/django-response-timeout/issues
55
56 To contribute code in any form, fork the repository and clone it locally.
57 Create a new branch for your feature::
58
59 git commit -b feature/whatever-you-like
60
61 Then make sure all the tests past (and write new ones for any new features)::
62
63 pip install -e .
64 pip install -r requirements-dev.txt
65 django-admin.py test --settings=test.settings
66
67 Check if the README.rst looks right::
68
69 restview --long-description
70
71 Then push the finished feature to github and open a pull request form the branch.
72
73 New Release
74 ^^^^^^^^^^^
75 To create a new release:
76
77 1. Add changes to ``CHANGES.txt``
78 2. Change version in ``setup.py``
79 3. ``python setup.py register``
80 4. ``python setup.py sdist upload``
Something went wrong with that request. Please try again.