{"id":8944,"library":"django-cloudinary-storage","title":"Django Cloudinary Storage","description":"django-cloudinary-storage is a Django package that provides custom storage backends for Cloudinary, allowing both media and static files to be served from Cloudinary. It also includes management commands for file cleanup. The current version is 0.3.0, released with support for Django 2 and Python 3.6+, with infrequent releases focusing on Django version compatibility.","status":"active","version":"0.3.0","language":"python","source_language":"en","source_url":"https://github.com/klis87/django-cloudinary-storage","tags":["django","cloudinary","storage","media","static-files","cloud"],"install":[{"cmd":"pip install django-cloudinary-storage","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This is a Django package, requiring Django to operate.","package":"Django","optional":false},{"reason":"Required for interaction with the Cloudinary API.","package":"cloudinary","optional":false}],"imports":[{"wrong":"from cloudinary_storage.storage import MediaCloudinaryStorage","symbol":"MediaCloudinaryStorage","correct":"from cloudinary_storage.storage import MediaCloudinaryStorage"}],"quickstart":{"code":"import os\n\n# settings.py\n\nINSTALLED_APPS = [\n    # ... other Django apps ...\n    'django.contrib.staticfiles',\n    'cloudinary_storage',\n]\n\n# ... other Django settings (MIDDLEWARE, TEMPLATES, DATABASES, etc.) ...\n\n# Cloudinary Credentials (strongly recommended to use environment variables)\nCLOUDINARY_CLOUD_NAME = os.environ.get('CLOUDINARY_CLOUD_NAME', '')\nCLOUDINARY_API_KEY = os.environ.get('CLOUDINARY_API_KEY', '')\nCLOUDINARY_API_SECRET = os.environ.get('CLOUDINARY_API_SECRET', '')\n\n# Default Storage for Media Files\nDEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'\nMEDIA_URL = '/media/' # This is still needed for Django's internal URL handling\n\n# Default Storage for Static Files\nSTATICFILES_STORAGE = 'cloudinary_storage.storage.StaticCloudinaryStorage'\nSTATIC_URL = '/static/' # This is still needed for Django's internal URL handling\n\n# Optional: Configure prefixing for URLs on Cloudinary (e.g., to group files)\nCLOUDINARY_STORAGE = {\n    'MEDIA_TAG': 'media',\n    'STATIC_TAG': 'static',\n    'MEDIA_DELIVERY_URL_WITH_PREFIX': True,\n    'STATIC_DELIVERY_URL_WITH_PREFIX': True,\n    'PREFIX': os.environ.get('CLOUDINARY_URL_PREFIX', None), # e.g., 'my_django_project'\n}\n\n# Example usage in a model:\n# from django.db import models\n# class MyPhoto(models.Model):\n#     title = models.CharField(max_length=100)\n#     image = models.ImageField(upload_to='photos/%Y/%m/')\n","lang":"python","description":"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."},"warnings":[{"fix":"Disregard the 'removed Python 3 support' note. Ensure your project uses Python 3.6+.","message":"The 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.","severity":"gotcha","affected_versions":"0.3.0 (documentation only)"},{"fix":"Upgrade 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.","message":"Version 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.","severity":"breaking","affected_versions":"<0.3.0 when used with Django 2.x+"},{"fix":"Ensure all three environment variables or direct settings are present and hold valid Cloudinary account credentials in your `settings.py`.","message":"Cloudinary 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Add or update these settings in your `settings.py` to enable Cloudinary for media and static files respectively.","message":"To 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'`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.3.0':42 '2':48 '3.6':51 'allow':19 'also':31 'backend':16 'cleanup':37 'cloud':67 'cloudinari':2,6,18,29,61 'command':34 'compat':59 'current':39 'custom':14 'django':1,5,10,47,57,60 'django-cloudinary-storag':4 'file':24,36,66 'focus':55 'includ':32 'infrequ':53 'manag':33 'media':21,63 'packag':11 'provid':13 'python':50 'releas':43,54 'serv':27 'static':23,65 'static-fil':64 'storag':3,7,15,62 'support':45 'version':40,58","created_at":"2026-04-16T18:47:39.913282+00:00","updated_at":"2026-04-16T18:47:39.913282+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpp_pvhyop/venv/lib/python3.12/site-packages/cloudinary_storage/storage.py\", line 10, in <module>\n    from django.conf import settings\nModuleNotFoundError: No module named 'django'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.3.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/klis87/django-cloudinary-storage","docs":null,"changelog":null,"pypi":"https://pypi.org/project/django-cloudinary-storage/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}