djangoplay-web / Assets / Cloudflare R2 Frontend CDN
DocsDjangoPlay WebAssetsCloudflare R2 Frontend CDN

Cloudflare R2 Frontend CDN

Frontend assets can be served from Cloudflare R2.

1 min readApplies to v1.2.2
On this page ▾
  1. Asset Groups
  2. Versioning
  3. Push
  4. CDN Template Tag
  5. Important

Asset Groups

R2 may serve:

text
dist/
assets/
vendor/
generated/

Django-native static files remain local.

Versioning

Assets are uploaded under a release-version prefix:

text
dist/v1.2.1/
assets/v1.2.1/
vendor/v1.2.1/

The version is configured through the application's CDN configuration.

Push

bash
bash webapp/frontend/packaging/minify.sh r2

The command builds the frontend and uploads the release assets using rclone.

CDN Template Tag

Templates use:

text
cdn_static

for CDN-eligible assets.

When CDN delivery is disabled, the tag falls back to normal Django static handling.

Important

There is no automatic local fallback once an environment is configured to depend on R2. Validate uploaded objects before enabling the CDN in production.