Skip to main content

Cloudflare Images integration for Django

Project description


This is a Django library to add support to Cloudflare Images to the ImageField.

It supports:

  • Django 3
  • Django 4
  • Django 5


pip install django-cloudflare-images


You need to add the following your

  1. If you are running Django 4.2+:
STORAGES = {"default": {"BACKEND": ""}}
  1. Else:

And then add the remaining of the configuration:


If you wish to use a default variant for a specific field you need to change your ImageField to a CloudflareImagesField see example below:

from cloudflare_images.field import CloudflareImagesField
from django.db import models

class MyModel(models.Model):
    image = CloudflareImagesField(variant="custom")

Please note that you will need to migrate your model(s) once you swapped the field(s). No SQL will actually be applied (you can check by running sqlmigrate <module> <number>).

If you wish to use a custom domain to serve your images you need to add the following to your


If you wish to use a default variant other than "public" to serve your images you need to add the following to your


If you wish to override the default timeout of 60 seconds for API requests, you need to add the following to your



Installing for development:

make install

Cleaning the installation:

make clean

Format the code:

make format

Check the code (for linting errors):

make check

Running all tests:

make test

Create a sdist+bdist package in dist/:

make package

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_cloudflare_images-0.6.0.tar.gz (7.3 kB view hashes)

Uploaded Source

Built Distribution

django_cloudflare_images-0.6.0-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page