Registry /
web-framework / django-cloudinary-storage
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.915 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.5MB
glibcpy 3.10–3.915 runs
installs and imports cleanly · install 2.3s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MediaCloudinaryStorage
✓ from cloudinary_storage.storage import MediaCloudinaryStorage
✗ from cloudinary_storage.storage import MediaCloudinaryStorage
To quickly integrate django-cloudinary-storage, add `'cloudinary_storage'` to `INSTALLED_APPS` and configure the Cloudinary credentials. Then, set `DEFAULT_FILE_STORAGE` for media files and `STATICFILES_STORAGE` for static files in your `settings.py`. Ensure your `CLOUDINARY_CLOUD_NAME`, `CLOUDINARY_API_KEY`, and `CLOUDINARY_API_SECRET` are correctly set, ideally via environment variables.
import os
# settings.py
INSTALLED_APPS = [
# ... other Django apps ...
'django.contrib.staticfiles',
'cloudinary_storage',
]
# ... other Django settings (MIDDLEWARE, TEMPLATES, DATABASES, etc.) ...
# Cloudinary Credentials (strongly recommended to use environment variables)
CLOUDINARY_CLOUD_NAME = os.environ.get('CLOUDINARY_CLOUD_NAME', '')
CLOUDINARY_API_KEY = os.environ.get('CLOUDINARY_API_KEY', '')
CLOUDINARY_API_SECRET = os.environ.get('CLOUDINARY_API_SECRET', '')
# Default Storage for Media Files
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
MEDIA_URL = '/media/' # This is still needed for Django's internal URL handling
# Default Storage for Static Files
STATICFILES_STORAGE = 'cloudinary_storage.storage.StaticCloudinaryStorage'
STATIC_URL = '/static/' # This is still needed for Django's internal URL handling
# Optional: Configure prefixing for URLs on Cloudinary (e.g., to group files)
CLOUDINARY_STORAGE = {
'MEDIA_TAG': 'media',
'STATIC_TAG': 'static',
'MEDIA_DELIVERY_URL_WITH_PREFIX': True,
'STATIC_DELIVERY_URL_WITH_PREFIX': True,
'PREFIX': os.environ.get('CLOUDINARY_URL_PREFIX', None), # e.g., 'my_django_project'
}
# Example usage in a model:
# from django.db import models
# class MyPhoto(models.Model):
# title = models.CharField(max_length=100)
# image = models.ImageField(upload_to='photos/%Y/%m/')
Debug
Known issues
gotchaThe release notes for v0.3.0 on GitHub contain a typo stating it 'removed Python 3 support'. This is incorrect. Version 0.3.0 and later actually require Python 3.6+ and are compatible with modern Django versions.fixDisregard the 'removed Python 3 support' note. Ensure your project uses Python 3.6+.
affects: 0.3.0 (documentation only)
breakingVersion 0.3.0 explicitly added support for Django 2.x. If you are using Django 2.x or newer, ensure you are using `django-cloudinary-storage` version 0.3.0 or higher. Older versions may not be compatible.fixUpgrade to `django-cloudinary-storage>=0.3.0` for Django 2.x+ projects. For older Django versions, check the `install_requires` in the `setup.py` of specific releases.
affects: <0.3.0 when used with Django 2.x+
gotchaCloudinary API credentials (`CLOUDINARY_CLOUD_NAME`, `CLOUDINARY_API_KEY`, `CLOUDINARY_API_SECRET`) are mandatory for the storage to authenticate and function correctly. Misconfigured or missing credentials will lead to authentication errors.fixEnsure all three environment variables or direct settings are present and hold valid Cloudinary account credentials in your `settings.py`.
affects: All versions
gotchaTo ensure Django uses Cloudinary for file uploads, `DEFAULT_FILE_STORAGE` must be set to `'cloudinary_storage.storage.MediaCloudinaryStorage'`. Similarly, for static files, `STATICFILES_STORAGE` should be `'cloudinary_storage.storage.StaticCloudinaryStorage'`.fixAdd or update these settings in your `settings.py` to enable Cloudinary for media and static files respectively.
affects: All versions
Upgrade
Version history
0.3.0latest on PyPI · released Aug 23, 2020
Audit
Dependencies
DjangorequiredThis is a Django package, requiring Django to operate.
cloudinaryrequiredRequired for interaction with the Cloudinary API.