Find changed static files, show their URLs, and optionally purge them for you on your CDN.
Project description
purge-static
![PyPI - Python Version](https://pypi-camo.freetls.fastly.net/782acf869fc5004d50a2a21459e8174c67388e9a/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f70757267652d7374617469632e737667)
purge-static
is a tool to find changed static files, show their URLs,
and optionally purge them for you on your CDN, such as CloudFlare.
With purge-static
, you can enable aggressive caching for your static
site on your CDN, caching the entire site on the CDN edge. When you update
your site, you simply need to use purge-static
to purge only the changed
files.
purge-static
uses the SHA256 hash of files to determine if they changed.
Installation
pip install purge-static
Example Invocation
purge-static -d /path/to/my/webroot -u https://example.com
If your webroot is not writable, you can select a different path to write
the hash store with --store /path/to/a/file/to/store/hashes
.
This example ignores all .gz
files, since they are only used for nginx
's
gzip_static
module, as well as all files with hash already in the name:
purge-static -d /path/to/my/webroot -u https://example.com \
-i '.*\.gz$|.*-[0-9a-f]{64}\.'
For more detailed description of the arguments, run purge-static --help
.
CloudFlare
To use CloudFlare, you will need to create a credentials file:
{
"email": "you@example.com",
"api_key": "myverysecretapikey"
}
Then, you can invoke purge-static
:
purge-static -d /path/to/my/webroot -u https://example.com \
--cloudflare -c /path/to/my/credentiails -z mycloudflarezoneid
Note that -z
takes the CloudFlare zone ID as 32 hex digits.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for purge_static-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1eb6f4291f918f2d2053a1d1e20ab6280865b25e51c70e77d0ad66d24222b6f |
|
MD5 | 4c3ff6f9654279dec4eddf00c88f2b62 |
|
BLAKE2b-256 | a1f073d9352b6765512be09745db5a7489aa3604614c1e377ee0621be651eceb |