-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from SlashRoot/master
0.9.0 Release Candidate
- Loading branch information
Showing
50 changed files
with
794 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ _trial_temp* | |
ignore* | ||
*.log | ||
*.log.* | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
##Caching | ||
|
||
At the moment a caching server is deployed by default on port 8000. Is serves | ||
gzipped content, which is pretty cool - right? | ||
|
||
#####How it works | ||
|
||
The Hendrix cache server is a reverse proxy that sits in front your Django app. | ||
However, if you wanted to switch away from the cache server you can always point | ||
to the http port (default 8080). | ||
|
||
It works by forwarding requests to the http server running the app and | ||
caches the response depending on the availability of `max-age` [seconds] in a | ||
`Cache-Control` header. | ||
|
||
#####Busting the cache | ||
|
||
Note that you can bust the cache (meaning force it not to cache) by passing | ||
a query in your GET request e.g. `http://somesite.com/my/resource?somevar=test`. | ||
You can also force the query to cache by specifying `cache=true` in the query | ||
e.g. `http://somesite.com/my/resource?somevar=test,cache=true` (so long as a | ||
`max-age` is specified for the handling view). | ||
What this means is that you can let the browser do some or none of the js/css | ||
caching if you so want. | ||
|
||
#####Caching in Django | ||
|
||
In your project view modules use the `cache_control` decorator to add | ||
a `max-age` of your choosing. e.g. | ||
|
||
```python | ||
from django.views.decorators.cache import cache_control | ||
|
||
@cache_control(max_age=60*60*24) # cache it for a day | ||
def homePageView(request): | ||
... | ||
``` | ||
|
||
and that's it! Hendrix will do the rest. Django docs examples [here](https://docs.djangoproject.com/en/dev/topics/cache/#controlling-cache-using-other-headers) | ||
|
||
#####Turning cache off | ||
|
||
You can turn caching on by passing the flags `-c` or `--cache`. You can also change which | ||
port you want to use with the `--cache_port` option. | ||
|
||
#####Global Vs Local | ||
|
||
If you're running multiple process using the `-w` or `--workers` options caching | ||
will be process distributed by default. Meaning there will be a reverse proxy | ||
cache server for each process. However if you want to run the reverse | ||
proxy server on a single process just use the `-g` or `--global_cache` flags. | ||
|
||
... here "local" means local to the process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#Installation | ||
|
||
You'll need to use **virtualenv**. If you don't have that set up, follow [the virtualenv instructions here.](http://docs.python-guide.org/en/latest/dev/virtualenvs/) | ||
|
||
Inside your python virtuaenv: | ||
|
||
```bash | ||
$ pip install hendrix | ||
``` | ||
|
||
The following python packages are dependencies that should be automaticly installed. | ||
|
||
```bash | ||
twisted | ||
txsockjs | ||
zope.interface | ||
watchdog | ||
jinja2 | ||
pychalk==0.0.5 | ||
service_identity | ||
``` | ||
|
||
###Extra Setup for SSL | ||
|
||
```bash | ||
$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev | ||
$ pip install cryptography | ||
``` | ||
|
||
For usage details, see [Quickstart](quickstart.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.