Overview
Tesis Rutas uses Cloudinary for storing and managing all tourism-related media files including destination images, videos, and other multimedia content. This guide covers account setup, configuration, and best practices.Prerequisites
- A Cloudinary account (free tier available)
- Python 3.8+ environment
- Access to your project’s configuration files
Configuration Setup
Create Cloudinary Account
- Sign up at cloudinary.com
- Navigate to your Dashboard
- Copy your credentials:
- Cloud Name
- API Key
- API Secret
Configure Environment Variables
Add your Cloudinary credentials to your environment configuration:
The system automatically loads from
local_config.json for development or .env for production environments.Folder Structure
Tesis Rutas organizes media by destination:Upload Implementation
Single File Upload
The platform supports uploading images and videos with automatic resource type detection:Multiple File Upload (Async)
For better performance, the platform uploads multiple files asynchronously:src/infrastructure/api/routers/destinos_router.py
Upload Limits
The platform enforces the following limits:| Limit Type | Value | Description |
|---|---|---|
| Per Request | 1-3 files | Maximum files per upload request |
| Per Destination | 10 files | Total multimedia files per destination |
| Resource Types | image, video | Supported media types |
Validation Example
src/infrastructure/api/routers/destinos_router.py
Deleting Media
Delete Individual File
Delete Entire Destination Folder
When deleting a destination, remove its entire Cloudinary folder:src/infrastructure/api/routers/destinos_router.py
Error Handling
Upload Rollback
If database insertion fails after upload, the platform automatically removes uploaded files:src/infrastructure/api/routers/destinos_router.py
Best Practices
Organize by Destination
Organize by Destination
Always use the folder structure
destinations/{destino_id} to keep media organized and make cleanup easier.Use resource_type='auto'
Use resource_type='auto'
Let Cloudinary automatically detect whether the file is an image or video instead of manually specifying the type.
Store Metadata
Store Metadata
Save key information in your database:
secure_url: HTTPS URL to access the filepublic_id: Unique identifier for deletionformat: File extension (jpg, png, mp4, etc.)bytes: File size for tracking storage usage
Implement Rollback
Implement Rollback
Always implement rollback mechanisms to delete Cloudinary files if database operations fail.
Enforce Limits
Enforce Limits
Validate upload limits both per-request and per-destination to prevent abuse and manage storage costs.
Testing Your Setup
Verify your Cloudinary configuration:Next Steps
API Reference
Explore the multimedia upload endpoints
Maps Integration
Display destinations on interactive maps