Django Tutorial #17 - Uploading Media

preview_player
Показать описание
Hey gang, in this django tutorial I'll show you how we can upload media to our articles / blog posts.

----- COURSE LINKS:

======== Other Tutorials =========

----- NODE.JS TUTORIALS

----- MONGODB TUTORIALS

======== Social Links ==========

Рекомендации по теме
Комментарии
Автор

Thank you Net Ninja! This specific feature is often overlooked in 90% of all tutorials.

ScumbagKonflict
Автор

django + vue tutorial would be the best for real. if you created a series like that i would be so motivated from you because your teaching style is the best ever. and I loved django and vue from the first time i used them.

lasmenso
Автор

can I use it in production mode? A lot of website says that it only works in development mode

taihatranduc
Автор

some tutorial websites have dynamic number of images(screenshot of some implementation) and text body explaining those images...Each tutorial can require different number of images and text body...so how to achieve that?

djrenders
Автор

The images are not showing in the URl. Even I followed the each line as copy cat....after failing twice but still the images. Are not showing even not the default one

rishabhverma
Автор

Awesome series. I came back to this lesson after i finished them all because i noticed front end uploads weren't working for me. Was always going to the default image. If i later go to admin i see there is no image uploaded.

HasoVids
Автор

thanks... just a question if anyone can answer me i will grateful. i have a problem that default image is not selected automatically if i don't chose a file and that generates an error although I specified thumb=models.ImageField(default='default.png', blank=True)? I can see in the video around time 9:00 when he tried to chose an image in the admin page, the default image was not there(same problem that i have). did he manually chose default.png for each article and then he change it? if so what is the point of using default image property. I even tried downloading the project from git hub and run it. I tried removing one of the articles image and then checked and there was no default image(same result that I have?). the other thing when you leave an article without an image you will get an error because thumb has no image although we set the property to blank=True? any help will be highly appreciated.

wisamkhalid
Автор

Which keyboard you were using here!? It a catchy sound when you type..

yashv
Автор

Can anyone explain to me how our upload is automatically going to the media folder is this something with Django that it automatically keeps the image files in the media folder or I'm am I not getting the logic here

tusharraina
Автор

Why you didn't specify pillow in the installed apps list of the setting file after installation? I'm confused because I thought this step is required

sort_to_see_hidden_comments
Автор

If you're running Django 5.0 onwards you need to write:

in base.html:
{% load static %}

in settings.py:
MEDIA_URL = 'media/'

MEDIA_ROOT = (
BASE_DIR/'media'
)

Do NOT put a comma after 'media' in MEDIA_ROOT

leaningtower
Автор

Thank you brother, you did a great job!

asylbekbekmurzaev
Автор

hey please help me
The current path, media/images2.jpg, didn't match any of these.
pls give me a solution

hasifibrahim
Автор

pls help why cant i display the images this time...it just pure white..

yexiu
Автор

idk why, but image is not visible on the webpage after doing the above steps. Can someone help?

yatharthmanchanda
Автор

If you have an error "expected str, bytes or os.PathLike object, not list", go to the settings py file and check that you dont have square brackets around MEDIA_ROOT.

toctoc
Автор

Images not showing for me in 2023. I installed pillow. I dont know how to show the image. My configuration is correct but its showing the broken image and alt text. Can somebody please help

johnjim
Автор

I watched your vue.js tutorials, those were really awesome.Thank you for making such tutorials, and can you make some tutorials for how to use vue.js along with Django.

srinivasr
Автор

Thank you Sir.Great tutorial but what if i want to upload a media file like mp4 etc and i want to display on my webpage how can we do that??

SinghFlex
Автор

Hi THe Net Ninja, you know some way to hide or restrict access to the url '/ MEDIA /' files in Django

gilbertus