- Install the cloudinary-django package using pip:
pip install cloudinary-django
- Add 'cloudinary' to the INSTALLED_APPS list in your Django settings file:
INSTALLED_APPS = [
# ...
'cloudinary',
# ...
]
- Add your Cloudinary configuration to the settings file:
CLOUDINARY = {
'cloud_name': 'your_cloud_name',
'api_key': 'your_api_key',
'api_secret': 'your_api_secret'
}
- Use the CloudinaryField in your models to store Cloudinary media:
from cloudinary.models import CloudinaryField
class YourModel(models.Model):
image = CloudinaryField('image')
- In your template, display the image using the Cloudinary tag:
{% load cloudinary %}
<img src="{% cloudinary 'your_image' %}" alt="Your Image">