Find changed static files, show their URLs, and optionally purge them for you on your CDN.
Project description
purge-static

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:
{"api_token": "myverysecretapitoken"}
For legacy API keys, use this instead:
{
"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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file purge-static-0.2.0.tar.gz.
File metadata
- Download URL: purge-static-0.2.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ff312ac98e32acba05185b7e421f9abc3e4023868355632d1ee660ecc2b43f
|
|
| MD5 |
e7090d6cb222a8f1d32b50df471d5074
|
|
| BLAKE2b-256 |
13fff6829bec7e03d1713226d70d0f3a5ac9bb45586c7f16ff87d337be300f90
|
File details
Details for the file purge_static-0.2.0-py3-none-any.whl.
File metadata
- Download URL: purge_static-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2e48ab3c3043e36796419722eacafc601d2d215e8c7fd8b3a218854e882fe1f
|
|
| MD5 |
6f949847c457c5f9085286adf70707ba
|
|
| BLAKE2b-256 |
b3b5a38319e579d8b8267592df3e71b90cf774fe1a23cdb1fcf6b729ef1c5b17
|