{"id":31585,"date":"2025-11-16T15:58:14","date_gmt":"2025-11-16T23:58:14","guid":{"rendered":"https:\/\/cloudinary.com\/blog\/?p=31585"},"modified":"2025-11-17T05:59:06","modified_gmt":"2025-11-17T13:59:06","slug":"managing-media-files-in-django","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django","title":{"rendered":"Managing Media Files in Django (Images, Videos, and Audio)"},"content":{"rendered":"\n<p>Picture yourself developing an e-commerce website where users can upload product images and videos. You&#8217;re handling a substantial volume of media files, potentially thousands, as these visual assets play a critical role in attracting buyers and effectively showcasing your products. However, managing an extensive media library can pose complex challenges and demand considerable resources.<\/p>\n\n\n\n<p>In this article, we\u2019ll unveil transformative techniques for managing media files in Django with Cloudinary to make your life easier as a developer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Benefits of Streamlined Media Management<\/h2>\n\n\n\n<p>Before we delve into the practical side, let&#8217;s highlight the key advantages of optimizing media management:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Enhanced media processing.<\/strong> Streamlining media handling with AI-driven editing and auto-tagging via upload presets saves time and simplifies content management.<\/li>\n\n\n\n<li><strong>Effortless uploading. <\/strong>Simplifying media uploads eliminates the need for complex server-side code and reduces time spent on uploads.<\/li>\n\n\n\n<li><strong>Streamlined searching. <\/strong>Advanced search capabilities eliminate manual tasks and database queries, making it easy to find the media you need.<\/li>\n\n\n\n<li><strong>Optimized delivery.<\/strong> Delivering content efficiently with dynamic transformations ensures a superior user experience without pre-processing hassles.<\/li>\n<\/ul>\n\n\n\n<p>All this is made possible with Cloudinary. <a href=\"https:\/\/cloudinary.com\/documentation\/solution_overview#storage\">Storing your media in Cloudinary<\/a> eliminates the need for a database and allows for flexible image adaptation based on user preferences, device types, or responsive design, providing on-the-fly, well-optimized content delivery.<\/p>\n\n\n\n<p>Managing media files in Django becomes more manageable with these steps, which we cover next (tap the icons to navigate to the related section):<\/p>\n\n\n\n<div style=\"width:100%;max-width:850px;position:relative;\">\n<img decoding=\"async\" style=\"max-width:100%;\" src=\"https:\/\/cloudinary-res.cloudinary.com\/image\/upload\/v1698223367\/blog\/django_media_management.png\" \/>\n<a style=\"height:100%;position:absolute;left:0%;top:0%;width:20%;\" href=\"#setup_and_configuration\" target=\"_self\" rel=\"noopener\"><\/a>\n<a style=\"height:100%;position:absolute;left:20%;top:0%;width:20%;\" href=\"#enhanced_media_processing_with_upload_presets\" target=\"_self\" rel=\"noopener\"><\/a>\n<a style=\"height:100%;position:absolute;left:40%;top:0%;width:20%;\" href=\"#uploading_media_with_python_and_django\" target=\"_self\" rel=\"noopener\"><\/a>\n<a style=\"height:100%;position:absolute;left:60%;top:0%;width:20%;\" href=\"#searching_made_simple\" target=\"_self\" rel=\"noopener\"><\/a>\n<a style=\"height:100%;position:absolute;left:80%;top:0%;width:20%;\" href=\"#delivering_your_media\" target=\"_self\" rel=\"noopener\"><\/a>\n\n\n\n<h2 class=\"wp-block-heading\">Setup and Configuration<\/h2>\n\n\n\n<p>Before we dive into the specifics of media management with Python and Django, you&#8217;ll need to sign up for <a href=\"https:\/\/cloudinary.com\/users\/register\/free\" target=\"_blank\" rel=\"noreferrer noopener\">Cloudinary<\/a>. It&#8217;s quick and straightforward.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing and Configuring Cloudinary in Your Python\/Django App<\/h3>\n\n\n\n<p>To get started with Cloudinary in your Python\/Django app, follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Install the Cloudinary Python library using <code>pip install cloudinary<\/code>.<\/li>\n\n\n\n<li>Configure Cloudinary in your <code>settings.py<\/code> with your credentials, ensuring they remain secure.<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-comment\"># settings.py<\/span>\nimport cloudinary\nimport cloudinary.uploader\nimport cloudinary.api\t\ncloudinary.config( \n  \tcloud_name = <span class=\"hljs-string\">\"your_cloud_name\"<\/span>,\n  \tapi_key = <span class=\"hljs-string\">\"your_api_key\"<\/span>,\n  \tapi_secret = <span class=\"hljs-string\">\"your_api_secret\"<\/span>\n)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<div class='c-callout  c-callout--inline-title c-callout--note'><strong class='c-callout__title'>Note:<\/strong> <p>Replace <code>your_cloud_name<\/code>, <code>your_api_key<\/code>, and <code>your_api_secret<\/code> with your actual Cloudinary credentials, which you can find on the <a href=\"https:\/\/console.cloudinary.com\/app\/settings\/api-keys\">API keys<\/a> page of the Console Settings.<\/p>\n<\/div>\n\n\n<p>With these two steps, you&#8217;ve successfully integrated Cloudinary into your Django project, and you&#8217;re ready to leverage its powerful media management capabilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Enhanced Media Processing With Upload Presets<\/h2>\n\n\n\n<p>Upload presets in Cloudinary enforce a variety of upload behavior to set the stage for simplified content management. In this article, we&#8217;ll focus on two essential upload options that you can enjoy. You can learn about many others by visiting the <a href=\"https:\/\/cloudinary.com\/documentation\/upload_presets\" target=\"_blank\" rel=\"noreferrer noopener\">documentation<\/a>.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Automating Transformation Settings<\/h3>\n\n\n\n<p>Set the default transformation settings for your uploaded images to automate resizing, filters, overlays, quality optimization, and AI-powered enhancements like background and object removal. Streamline content management and ensure consistent adherence to predefined settings. Here&#8217;s a glimpse of the possibilities:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img width=\"500\" height=\"303\" data-public-id=\"Web_Assets\/blog\/crop-1\/crop-1.gif\" loading=\"lazy\" decoding=\"async\" data-id=\"31589\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_500,h_303,c_scale\/f_auto,q_auto\/v1698140121\/Web_Assets\/blog\/crop-1\/crop-1.gif?_i=AA\" alt=\"Image showing example of Cloudinary Django automated image transformation: crop and resize of a picture of a room with a cactus\" class=\"wp-post-31585 wp-image-31589\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140121\" data-seo=\"1\" \/><figcaption class=\"wp-element-caption\">Crop &amp; Resize<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"500\" height=\"303\" data-public-id=\"Web_Assets\/blog\/enhance-1\/enhance-1.gif\" loading=\"lazy\" decoding=\"async\" data-id=\"31593\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_500,h_303,c_scale\/f_auto,q_auto\/v1698140111\/Web_Assets\/blog\/enhance-1\/enhance-1.gif?_i=AA\" alt=\"Image showing example of Cloudinary Django automated image transformation: sharpen a picture of a cactus planter\" class=\"wp-post-31585 wp-image-31593\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140111\" data-seo=\"1\" \/><figcaption class=\"wp-element-caption\">Sharpen<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"500\" height=\"303\" data-public-id=\"Web_Assets\/blog\/remove_obj\/remove_obj.gif\" loading=\"lazy\" decoding=\"async\" data-id=\"31595\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_500,h_303,c_scale\/f_auto,q_auto\/v1698140102\/Web_Assets\/blog\/remove_obj\/remove_obj.gif?_i=AA\" alt=\"Image showing example of Cloudinary Django automated image transformation: remove objects from a picture of a succulent in a pot\" class=\"wp-post-31585 wp-image-31595\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140102\" data-seo=\"1\" \/><figcaption class=\"wp-element-caption\">Remove Objects<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"500\" height=\"303\" data-public-id=\"Web_Assets\/blog\/recolor\/recolor.gif\" loading=\"lazy\" decoding=\"async\" data-id=\"31594\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_500,h_303,c_scale\/f_auto,q_auto\/v1698140107\/Web_Assets\/blog\/recolor\/recolor.gif?_i=AA\" alt=\"Image showing example of Cloudinary Django automated image transformation: recolor of a picture of a flower\" class=\"wp-post-31585 wp-image-31594\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140107\" data-seo=\"1\" \/><figcaption class=\"wp-element-caption\">Recolor<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"500\" height=\"303\" data-public-id=\"Web_Assets\/blog\/overlay\/overlay.gif\" loading=\"lazy\" decoding=\"async\" data-id=\"31588\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_500,h_303,c_scale\/f_auto,q_auto\/v1698140126\/Web_Assets\/blog\/overlay\/overlay.gif?_i=AA\" alt=\"Image showing example of Cloudinary Django automated image transformation: image overlay of a picture of a room with cacti\" class=\"wp-post-31585 wp-image-31588\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140126\" data-seo=\"1\" \/><figcaption class=\"wp-element-caption\">Image Overlay<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"500\" height=\"303\" data-public-id=\"Web_Assets\/blog\/background-1\/background-1.gif\" loading=\"lazy\" decoding=\"async\" data-id=\"31590\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_500,h_303,c_scale\/f_auto,q_auto\/v1698140116\/Web_Assets\/blog\/background-1\/background-1.gif?_i=AA\" alt=\"Image showing example of Cloudinary Django automated image transformation: background removal of a picture of a succulent in a pot\" class=\"wp-post-31585 wp-image-31590\" data-format=\"gif\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140116\" data-seo=\"1\" \/><figcaption class=\"wp-element-caption\">Background Removal<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Leveraging Auto-Tagging<\/h3>\n\n\n\n<p>Enhance content organization by adding relevant tags based on image content. Increase searchability and content discovery, and simplify the process of organizing and categorizing your media assets.<\/p>\n\n\n\n<p>Computer <a href=\"https:\/\/cloudinary.com\/blog\/computer-vision-image-analysis-e-commerce-website\">Vision Image Analysis for Your E-commerce Website<\/a> to see Cloudinary in action, returning information about the content it identifies in your images.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating an Upload Preset&nbsp;<\/h3>\n\n\n\n<p>To create an upload preset with the desired options, you can use the <code>cloudinary.api.create_upload_preset<\/code> method from the SDK. Here&#8217;s an example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-comment\"># Define the upload preset details<\/span>\nupload_preset_name = <span class=\"hljs-string\">\"my_preset\"<\/span>\nupload_preset_options = {\n    <span class=\"hljs-string\">\"unsigned\"<\/span>: <span class=\"hljs-keyword\">False<\/span>,\n    <span class=\"hljs-string\">\"folder\"<\/span>: <span class=\"hljs-string\">\"my_folder\"<\/span>,\n    <span class=\"hljs-string\">\"tags\"<\/span>: <span class=\"hljs-string\">\"my_tags\"<\/span>,\n    <span class=\"hljs-string\">\"transformation\"<\/span>: &#91;\n        {<span class=\"hljs-string\">\"width\"<\/span>: <span class=\"hljs-number\">500<\/span>, <span class=\"hljs-string\">\"height\"<\/span>: <span class=\"hljs-number\">500<\/span>, <span class=\"hljs-string\">\"crop\"<\/span>: <span class=\"hljs-string\">\"fill\"<\/span>},\n        {<span class=\"hljs-string\">\"effect\"<\/span>: <span class=\"hljs-string\">\"grayscale\"<\/span>},\n    ],\n    <span class=\"hljs-string\">\"categorization\"<\/span>: <span class=\"hljs-string\">\"aws_rek_tagging\"<\/span>,\n    <span class=\"hljs-string\">\"auto_tagging\"<\/span>: <span class=\"hljs-number\">0.9<\/span>\n}\n\n<span class=\"hljs-comment\"># Create the upload preset using the SDK<\/span>\nupload_preset = cloudinary.api.create_upload_preset(\n    name=upload_preset_name,\n    settings=upload_preset_options\n)\n\n<span class=\"hljs-comment\"># Check if the upload preset was created successfully<\/span>\n<span class=\"hljs-keyword\">if<\/span> upload_preset.get(<span class=\"hljs-string\">\"name\"<\/span>) == upload_preset_name:\n    <span class=\"hljs-keyword\">print<\/span>(<span class=\"hljs-string\">\"Upload preset created successfully.\"<\/span>)\n<span class=\"hljs-keyword\">else<\/span>:\n    <span class=\"hljs-keyword\">print<\/span>(<span class=\"hljs-string\">\"Failed to create upload preset.\"<\/span>)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You can now use this upload preset when uploading media files using the Cloudinary Python SDK. Specify the name of the preset in your upload request, and the associated behavior you configured will be applied to your uploads.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Uploading Media With Python and Django<\/h2>\n\n\n\n<p>Uploading media files is the most essential step in content management. Let&#8217;s explore how Cloudinary\u2019s upload methods simplify this process and when you&#8217;ll want to use each type of upload.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Upload Widget<\/h3>\n\n\n\n<p>The Cloudinary Upload Widget simplifies media file uploads, seamlessly integrated into your Django project via HTML and JavaScript. It&#8217;s ideal for providing a user-friendly interface for file uploads from users.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/IxQBwELISpAPMHg9F9KjL-wNllLqJ5-KSqsB2NDFoAQmrc1DLC7p1xnKerR5nv53q8121byozAr9Kq3aw4aPSmCxBwkJeQSjfTJjJ0VKAIej9gCT-t1xwCFlE_l4zlj57kGeRWjRvvCOPL8VWl5ZZTo\" alt=\"Image showing screenshot of Cloudinary Django upload widget UI\" style=\"width:348px;height:276px\"\/><\/figure><\/div>\n\n\n<h4 class=\"wp-block-heading\">Example Use Case<\/h4>\n\n\n\n<p>In an e-commerce site, enable users to upload product images and videos with the Cloudinary Upload Widget, ensuring a smooth experience for sellers to enhance their listings with high-quality, optimized images and transformations.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img width=\"317\" height=\"512\" data-public-id=\"Web_Assets\/blog\/woman_sweater\/woman_sweater.png\" loading=\"lazy\" decoding=\"async\" data-id=\"31599\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_317,h_512,c_scale\/f_auto,q_auto\/v1698140094\/Web_Assets\/blog\/woman_sweater\/woman_sweater.png?_i=AA\" alt=\"Image showing example of Django Cloudinary upload widget: woman in sweater holding coffee\" class=\"wp-post-31585 wp-image-31599\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140094\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140094\/Web_Assets\/blog\/woman_sweater\/woman_sweater.png?_i=AA 317w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140094\/Web_Assets\/blog\/woman_sweater\/woman_sweater.png?_i=AA 186w\" sizes=\"auto, (max-width: 317px) 100vw, 317px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"512\" height=\"512\" data-public-id=\"Web_Assets\/blog\/baby_sweater\/baby_sweater.jpeg\" loading=\"lazy\" decoding=\"async\" data-id=\"31598\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_512,h_512,c_fill,g_auto\/f_auto,q_auto\/v1698140099\/Web_Assets\/blog\/baby_sweater\/baby_sweater.jpeg?_i=AA\" alt=\"Image showing example of Django Cloudinary upload widget: baby in a knitted coat and hat\" class=\"wp-post-31585 wp-image-31598\" data-format=\"jpeg\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140099\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140099\/Web_Assets\/blog\/baby_sweater\/baby_sweater.jpeg?_i=AA 512w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140099\/Web_Assets\/blog\/baby_sweater\/baby_sweater.jpeg?_i=AA 150w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140099\/Web_Assets\/blog\/baby_sweater\/baby_sweater.jpeg?_i=AA 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"424\" height=\"512\" data-public-id=\"Web_Assets\/blog\/man_sweater\/man_sweater.jpeg\" loading=\"lazy\" decoding=\"async\" data-id=\"31600\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_424,h_512,c_scale\/f_auto,q_auto\/v1698140091\/Web_Assets\/blog\/man_sweater\/man_sweater.jpeg?_i=AA\" alt=\"Image showing example of Django Cloudinary upload widget: man in sweater and sunglasses\" class=\"wp-post-31585 wp-image-31600\" data-format=\"jpeg\" data-transformations=\"f_auto,q_auto\" data-version=\"1698140091\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140091\/Web_Assets\/blog\/man_sweater\/man_sweater.jpeg?_i=AA 424w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698140091\/Web_Assets\/blog\/man_sweater\/man_sweater.jpeg?_i=AA 248w\" sizes=\"auto, (max-width: 424px) 100vw, 424px\" \/><\/figure>\n<\/figure>\n\n\n\n<p>To implement the Cloudinary Upload Widget in your Django app, follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a Django view in your Django app to display the HTML page with the Cloudinary Upload Widget:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-comment\"># media_app\/views.py<\/span>\nfrom django.shortcuts import render\ndef upload_media(request):\n    <span class=\"hljs-keyword\">return<\/span> render(request, <span class=\"hljs-string\">'media_app\/upload_media.html'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Create a template for the HTML page that includes the Cloudinary Upload Widget code. In your app&#8217;s templates directory, create a folder named <code>media_app<\/code> if it doesn&#8217;t already exist, and then create a new HTML template file, e.g., <code>upload_media.html<\/code>.<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\"><span class=\"hljs-comment\">&lt;!-- media_app\/templates\/media_app\/upload_media.html --&gt;<\/span>\n<span class=\"hljs-meta\">&lt;!DOCTYPE <span class=\"hljs-meta-keyword\">html<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>Media Upload Page<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"upload_widget\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"cloudinary-button\"<\/span>&gt;<\/span>Upload files<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">button<\/span>&gt;<\/span>\n\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"https:\/\/upload-widget.cloudinary.com\/global\/all.js\"<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/javascript\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>  \n\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\/javascript\"<\/span>&gt;<\/span><span class=\"javascript\">  \n        <span class=\"hljs-keyword\">var<\/span> myWidget = cloudinary.createUploadWidget({\n            <span class=\"hljs-attr\">cloudName<\/span>: <span class=\"hljs-string\">'my_cloud_name'<\/span>, \n            <span class=\"hljs-attr\">uploadPreset<\/span>: <span class=\"hljs-string\">'my_preset'<\/span>\n        }, (error, result) =&gt; { \n            <span class=\"hljs-keyword\">if<\/span> (!error &amp;&amp; result &amp;&amp; result.event === <span class=\"hljs-string\">\"success\"<\/span>) { \n                \t   <span class=\"hljs-comment\">\/\/ Access the delivery URL of the uploaded image <\/span>\n   <span class=\"hljs-keyword\">var<\/span> imageUrl = result.info.secure_url; \n   <span class=\"hljs-comment\">\/\/ Save imageUrl to your database <\/span>\n   <span class=\"hljs-comment\">\/\/ You can use an AJAX request to send this data to your server<\/span>\n   <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">'Done! Here is the image info: '<\/span>, result.info); \n            }\n        })\n\n        <span class=\"hljs-built_in\">document<\/span>.getElementById(<span class=\"hljs-string\">\"upload_widget\"<\/span>).addEventListener(<span class=\"hljs-string\">\"click\"<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span>(<span class=\"hljs-params\"><\/span>)<\/span>{\n            myWidget.open();\n        }, <span class=\"hljs-literal\">false<\/span>);\n    <\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Configure the URL pattern in your Django app&#8217;s <code>urls.py<\/code> to map to the view you created. Here&#8217;s an example:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-comment\"># media_app\/urls.py<\/span>\nfrom django.urls import path\nfrom . import views\n\nurlpatterns = &#91;\n    path(<span class=\"hljs-string\">'upload-media\/'<\/span>, views.upload_media, name=<span class=\"hljs-string\">'upload_media'<\/span>),\n]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Now, when you navigate to <code>http:\/\/your-django-app.com\/upload-media\/<\/code>, you&#8217;ll see the HTML page with the Cloudinary Upload Widget, and users can use it to upload media files. Adjust the URL and view names as needed to fit your project&#8217;s structure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Server-Side Upload<\/h3>\n\n\n\n<p>Server-side uploads offer automation, security, and scalability for media management, ideal for applications requiring efficient, hands-free handling.<\/p>\n\n\n\n<p>Consider news and content curation platforms that compile images, videos, and audio related to current events from various news agencies and social media posts. By utilizing Cloudinary for server-side uploads, they can automate processes like data analysis (tagging, captioning, object detection, etc.) and content moderation. This automation not only enhances data quality but also ensures a safer and more efficient user experience.<\/p>\n\n\n\n<p>Here\u2019s how to do it:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-comment\"># Uploading media from the server<\/span>\ndef upload_file_to_server(file_path):\n    result = cloudinary.uploader.upload(file_path, upload_preset=<span class=\"hljs-string\">\"my_upload_preset\"<\/span>)\n    <span class=\"hljs-keyword\">return<\/span> result&#91;<span class=\"hljs-string\">'secure_url'<\/span>]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And that&#8217;s it! Your media files are uploaded and ready to go, all thanks to Cloudinary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Searching Made Simple<\/h2>\n\n\n\n<p>If you\u2019ve applied auto-tagging on upload and are managing your assets on Cloudinary, you can utilize Cloudinary\u2019s efficient search capabilities. Imagine finding your asset quickly whenever you need it.\u00a0Gone are the days of manual media file searching. Enter, efficient and streamlined search.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\"><span class=\"hljs-comment\"># Efficiently searching for media files<\/span>\ndef search_media_by_tags(tags):\n    <span class=\"hljs-keyword\">return<\/span> cloudinary.Search().expression(f<span class=\"hljs-string\">'tags:{tags}'<\/span>).execute()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Delivering Your Media<\/h2>\n\n\n\n<p>If you&#8217;re managing your media assets in Cloudinary, you can effortlessly apply additional transformations to your content upon delivery using Django template tags. Here&#8217;s an example of how to set a custom image size dynamically:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-wrap-lines\">{% load cloudinary %}\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"{% cloudinary 'public_id' width=width height=height crop='fill' %}\"<\/span> <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"Your Image\"<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>These dynamic URL-based transformations empower you to deliver media files in the most efficient format and quality tailored to your users, all powered by Cloudinary.<\/p>\n\n\n\n<p>For a comprehensive guide on delivering responsive images, see <a href=\"https:\/\/cloudinary.com\/documentation\/responsive_html\" target=\"_blank\" rel=\"noreferrer noopener\">Responsive images using HTML and dynamic image transformations<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img width=\"1024\" height=\"512\" data-public-id=\"Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_1024,h_512,c_scale\/f_auto,q_auto\/v1698149581\/Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg?_i=AA\" alt=\"Example how Cloudinary helps you Manage Media Files in Django using templat tags: large image of man playing guitar with hat on\" class=\"wp-post-31585 wp-image-31619\" style=\"width:434px;height:217px\" data-format=\"jpeg\" data-transformations=\"f_auto,q_auto\" data-version=\"1698149581\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149581\/Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg?_i=AA 1600w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149581\/Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg?_i=AA 300w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149581\/Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg?_i=AA 768w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149581\/Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg?_i=AA 1024w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149581\/Web_Assets\/blog\/guitar-man-1\/guitar-man-1.jpeg?_i=AA 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div><\/div>\n<\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img width=\"600\" height=\"400\" data-public-id=\"Web_Assets\/blog\/guitar-man2-1\/guitar-man2-1.jpeg\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_600,h_400,c_scale\/f_auto,q_auto\/v1698149585\/Web_Assets\/blog\/guitar-man2-1\/guitar-man2-1.jpeg?_i=AA\" alt=\"Example how Cloudinary helps you Manage Media Files in Django using templat tags: medium image of man playing guitar with hat on\" class=\"wp-post-31585 wp-image-31618\" style=\"width:319px;height:213px\" data-format=\"jpeg\" data-transformations=\"f_auto,q_auto\" data-version=\"1698149585\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149585\/Web_Assets\/blog\/guitar-man2-1\/guitar-man2-1.jpeg?_i=AA 600w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149585\/Web_Assets\/blog\/guitar-man2-1\/guitar-man2-1.jpeg?_i=AA 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img width=\"400\" height=\"400\" data-public-id=\"Web_Assets\/blog\/guitar-man3-1\/guitar-man3-1.jpeg\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_400,h_400,c_fill,g_auto\/f_auto,q_auto\/v1698149587\/Web_Assets\/blog\/guitar-man3-1\/guitar-man3-1.jpeg?_i=AA\" alt=\"Example how Cloudinary helps you Manage Media Files in Django using templat tags: small image of man playing guitar with hat on\" class=\"wp-post-31585 wp-image-31617\" style=\"width:200px;height:200px\" data-format=\"jpeg\" data-transformations=\"f_auto,q_auto\" data-version=\"1698149587\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149587\/Web_Assets\/blog\/guitar-man3-1\/guitar-man3-1.jpeg?_i=AA 400w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149587\/Web_Assets\/blog\/guitar-man3-1\/guitar-man3-1.jpeg?_i=AA 150w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698149587\/Web_Assets\/blog\/guitar-man3-1\/guitar-man3-1.jpeg?_i=AA 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure><\/div>\n\n\n<p>For more information on delivering videos with Cloudinary, read <a href=\"https:\/\/cloudinary.com\/documentation\/video_overview\" target=\"_blank\" rel=\"noreferrer noopener\">Managing and delivering videos at scale<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Secret to Media File Management<\/h2>\n\n\n\n<p>In a nutshell, the methods we\u2019ve explored for managing media files in Django are your secret weapons as a developer. They turn challenging uploads, transformations, and content searches into a breeze, freeing up your time to create a stellar user experience. Find out all the ways <a href=\"https:\/\/cloudinary.com\/developers\">Cloudinary is built for developers<\/a>, helping you deliver beautiful web experiences faster.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Picture yourself developing an e-commerce website where users can upload product images and videos. You&#8217;re handling a substantial volume of media files, potentially thousands, as these visual assets play a critical role in attracting buyers and effectively showcasing your products. However, managing an extensive media library can pose complex challenges and demand considerable resources. In [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":31753,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[25,91],"class_list":["post-31585","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-asset-management","tag-django"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Managing Media Files in Django (Images, Videos, and Audio)<\/title>\n<meta name=\"description\" content=\"Learn how to use Cloudinary to manage media files in Django for simple media processing, upload, search and delivery.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Managing Media Files in Django (Images, Videos, and Audio)\" \/>\n<meta property=\"og:description\" content=\"Learn how to use Cloudinary to manage media files in Django for simple media processing, upload, search and delivery.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-16T23:58:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-17T13:59:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"sharonyelenik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\"},\"author\":{\"name\":\"sharonyelenik\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/dc4e70df8d22a9cfdad676a82fa92a73\"},\"headline\":\"Managing Media Files in Django (Images, Videos, and Audio)\",\"datePublished\":\"2025-11-16T23:58:14+00:00\",\"dateModified\":\"2025-11-17T13:59:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\"},\"wordCount\":1109,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA\",\"keywords\":[\"Asset Management\",\"Django\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\",\"url\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\",\"name\":\"Managing Media Files in Django (Images, Videos, and Audio)\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA\",\"datePublished\":\"2025-11-16T23:58:14+00:00\",\"dateModified\":\"2025-11-17T13:59:06+00:00\",\"description\":\"Learn how to use Cloudinary to manage media files in Django for simple media processing, upload, search and delivery.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA\",\"width\":2000,\"height\":1100,\"caption\":\"Image showing graphic with screenshot of Cloudinary Django UI\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Managing Media Files in Django (Images, Videos, and Audio)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/dc4e70df8d22a9cfdad676a82fa92a73\",\"name\":\"sharonyelenik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6565cdd768a04e9b6ea3932764886209dd9de8baeeef1504eaad8fe776677f92?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6565cdd768a04e9b6ea3932764886209dd9de8baeeef1504eaad8fe776677f92?s=96&d=mm&r=g\",\"caption\":\"sharonyelenik\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Managing Media Files in Django (Images, Videos, and Audio)","description":"Learn how to use Cloudinary to manage media files in Django for simple media processing, upload, search and delivery.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django","og_locale":"en_US","og_type":"article","og_title":"Managing Media Files in Django (Images, Videos, and Audio)","og_description":"Learn how to use Cloudinary to manage media files in Django for simple media processing, upload, search and delivery.","og_url":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django","og_site_name":"Cloudinary Blog","article_published_time":"2025-11-16T23:58:14+00:00","article_modified_time":"2025-11-17T13:59:06+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA","type":"image\/jpeg"}],"author":"sharonyelenik","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django"},"author":{"name":"sharonyelenik","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/dc4e70df8d22a9cfdad676a82fa92a73"},"headline":"Managing Media Files in Django (Images, Videos, and Audio)","datePublished":"2025-11-16T23:58:14+00:00","dateModified":"2025-11-17T13:59:06+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django"},"wordCount":1109,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA","keywords":["Asset Management","Django"],"inLanguage":"en-US","copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django","url":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django","name":"Managing Media Files in Django (Images, Videos, and Audio)","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA","datePublished":"2025-11-16T23:58:14+00:00","dateModified":"2025-11-17T13:59:06+00:00","description":"Learn how to use Cloudinary to manage media files in Django for simple media processing, upload, search and delivery.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/managing-media-files-in-django"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA","width":2000,"height":1100,"caption":"Image showing graphic with screenshot of Cloudinary Django UI"},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/managing-media-files-in-django#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Managing Media Files in Django (Images, Videos, and Audio)"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/dc4e70df8d22a9cfdad676a82fa92a73","name":"sharonyelenik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6565cdd768a04e9b6ea3932764886209dd9de8baeeef1504eaad8fe776677f92?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6565cdd768a04e9b6ea3932764886209dd9de8baeeef1504eaad8fe776677f92?s=96&d=mm&r=g","caption":"sharonyelenik"}}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1698102225\/Blog-Managing_Django_Media_Files\/Blog-Managing_Django_Media_Files.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/31585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=31585"}],"version-history":[{"count":53,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/31585\/revisions"}],"predecessor-version":[{"id":39298,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/31585\/revisions\/39298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/31753"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=31585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=31585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=31585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}