Cloudflare Images integration for Django
Project description
django-cloudflare-images
This is a Django library to add support to Cloudflare Images to the ImageField.
Installation
pip install django-cloudflare-images
Setup
You need to add the following your settings.py:
DEFAULT_FILE_STORAGE = "cloudflare_images.storage.CloudflareImagesStorage"
CLOUDFLARE_IMAGES_ACCOUNT_ID = "XXX"
CLOUDFLARE_IMAGES_API_TOKEN = "YYY"
CLOUDFLARE_IMAGES_ACCOUNT_HASH = "ZZZ"
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>
).
Development
Installing for development:
make install
Cleaning the installation:
make clean
Format the code:
make format
Running all tests:
make test
Setup.py commands:
make package-develop
make package-build
make package-install
make package-sdist
TODO
This is a list of non exhaustive list of things I would like to add to the project:
- Support custom domains (optional)
- Functional tests with real credentials (to be passed in the environment)
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
Hashes for django-cloudflare-images-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c8a8ac08325e646226a1901eca60899bfc864d35af6718250507f87f37f155d |
|
MD5 | 719749f3426f574c3c5afb79267765e9 |
|
BLAKE2b-256 | 1d6bdab496b51047e75dca3bdb2c37b24bc3d88264e6f085a2411657a1d168ce |