Django Tutorial #17 - Uploading Media

  Рет қаралды 72,133

Net Ninja

Net Ninja

Күн бұрын

Пікірлер
@leaningtower73
@leaningtower73 Жыл бұрын
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
@Gamycodes
@Gamycodes 11 ай бұрын
Good looking out!
@Mawuko-SenyoHayibor
@Mawuko-SenyoHayibor 9 ай бұрын
thank you
@lasmenso
@lasmenso 6 жыл бұрын
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.
@DuongTran-zh6td
@DuongTran-zh6td 2 жыл бұрын
Should be able to find media at localhost:8000/media 1:30 Settings.py i. MEDIA_URL = '/media/' ii. MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 3:30 urlpattern +=......... 5:40 (models) thumb = ...............
@wisamkhalid5663
@wisamkhalid5663 7 жыл бұрын
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.
@rishabhverma6619
@rishabhverma6619 4 жыл бұрын
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
@madusan1
@madusan1 7 жыл бұрын
Wondered if you are going to show a video upgrading your site to Django 2.0 ... Great videos! For instance django 2.0 uses 'path' where 'url' was used previously in the urls file...
@fisherpeyton2824
@fisherpeyton2824 3 жыл бұрын
@Kyng Gregory Yup, been using flixzone for since november myself =)
@renatojobal5123
@renatojobal5123 3 жыл бұрын
Really simple explanation. Thank you
@skalippanbalippan6972
@skalippanbalippan6972 7 жыл бұрын
Best django tutorial in the planet. you didn't lie about this
@yashv2000
@yashv2000 4 жыл бұрын
Which keyboard you were using here!? It a catchy sound when you type..
@toctoc4964
@toctoc4964 9 ай бұрын
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.
@HasoVids
@HasoVids 5 жыл бұрын
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.
@srinivasr5567
@srinivasr5567 7 жыл бұрын
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.
@lasmenso
@lasmenso 6 жыл бұрын
we really need that bro. django + vue
@asylbekbekmurzaev6098
@asylbekbekmurzaev6098 3 жыл бұрын
Thank you brother, you did a great job!
@malikbrahimi7504
@malikbrahimi7504 4 жыл бұрын
What about private media that isn't statically served like that? I'm using Django as my backend with React and I only want the image to be accessible if it's "owner" is authenticated.
@mudasirhayat4250
@mudasirhayat4250 2 жыл бұрын
can you share source code please?
@sort_to_see_hidden_comments
@sort_to_see_hidden_comments 3 жыл бұрын
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
@taihatranduc8613
@taihatranduc8613 5 жыл бұрын
can I use it in production mode? A lot of website says that it only works in development mode
@djrenders
@djrenders 6 жыл бұрын
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?
@cuteness8780
@cuteness8780 4 жыл бұрын
Hey .. Good video ..any tutorial for image gallary from youtube
@johnjim3741
@johnjim3741 Жыл бұрын
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
@hasifibrahim5846
@hasifibrahim5846 4 жыл бұрын
hey please help me The current path, media/images2.jpg, didn't match any of these. pls give me a solution
@SantoPapaVaticano
@SantoPapaVaticano 6 жыл бұрын
I need help, someone can help me, I am getting this error "expected str, bytes or os.PathLike object, not tuple", I dont know what I do :(
@AxmedShiimax
@AxmedShiimax 6 жыл бұрын
Me too
@sreepriyaganapathy8555
@sreepriyaganapathy8555 6 жыл бұрын
@@AxmedShiimax Please remove the , in the end of the code in settings. if we put , it automatically takes as a tuple.
@menjaholmwettergren5058
@menjaholmwettergren5058 5 жыл бұрын
Thanks I got the same error and your answer was the solution
@yatharthmanchanda8594
@yatharthmanchanda8594 Жыл бұрын
idk why, but image is not visible on the webpage after doing the above steps. Can someone help?
@MagnumIsWild
@MagnumIsWild 4 жыл бұрын
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
@arpitgupta1876
@arpitgupta1876 7 жыл бұрын
Sir , I put the defaul image as 'default.png ' but the file i dumped was 'default.jpg' i have changed it and even migrated the changes but it remains default.png PLZ help
@sammy9453
@sammy9453 4 жыл бұрын
you have to change the image for tuples which were present before changing the field. After changing the field new tuples will have the latest default image
@AbhishekKumar-mq1tt
@AbhishekKumar-mq1tt 7 жыл бұрын
Thank u for this awesome video.
@gilbertus5
@gilbertus5 5 жыл бұрын
Hi THe Net Ninja, you know some way to hide or restrict access to the url '/ MEDIA /' files in Django
@msrbq
@msrbq 5 жыл бұрын
You can maybe use staff_member_required function, but what is the point from that
@aXimo
@aXimo 5 жыл бұрын
I'm stuck... I did everything as you (checked twice), and images are only server from the article folder, not from the root folder/media... I'm on 2.2.6.
@austinmurphy9074
@austinmurphy9074 5 жыл бұрын
are u saying when you go to /media/ u get an error? or are u saying ur pictures are not showing up. Make sure to add default.png also
@danielfurey3081
@danielfurey3081 6 жыл бұрын
I kept getting "no such column: articles_article.thumb" when trying to load the articles page and the admin articles page. Even after I did makemigrations like Shaun pointed out. I was racking my brain on how the thumb object wouldn't work here. It turns out, maybe this is a difference in the versions of Django, you have to run "python manage.py migrate" as well. That got it to work for me. I don't remember Shaun saying you had to run anything other than makemigrations in the tutorial. So if you're getting that problem like I did, that's the fix.
@Alkanen
@Alkanen 6 жыл бұрын
He says just that at 8:10 in the movie. He even mistypes it first so he has to do it twice =)
@danielfurey3081
@danielfurey3081 6 жыл бұрын
Ah, thanks so much. I must have missed that.
@Alkanen
@Alkanen 6 жыл бұрын
@@danielfurey3081 no worries, it happens. God knows I miss most of the details in anything I watch :D
@nadimhayat3412
@nadimhayat3412 4 жыл бұрын
The png files aren't displaying properly on the website. What should i do?
@rishabhverma6619
@rishabhverma6619 4 жыл бұрын
Have u got solnnn????
@SinghFlex
@SinghFlex 6 жыл бұрын
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??
@afshananwarali9462
@afshananwarali9462 6 жыл бұрын
please share how did you upload videos to webpage? Is it possible simply by changing jpg or any image extension to mp4?
@sarthakpatelia9888
@sarthakpatelia9888 4 жыл бұрын
how to integrate youtube videos please let me know sir!!!
@OvaisDIYGarage
@OvaisDIYGarage 6 жыл бұрын
in django 2 if anyone is facing TypeError: 'module' object is not callable. the fix is to add "from django.contrib.staticfiles.urls import staticfiles_urlpatterns, static" . Rather then from django.conf.urls import static
@hakanhalil5493
@hakanhalil5493 6 жыл бұрын
love you man
@OvaisDIYGarage
@OvaisDIYGarage 6 жыл бұрын
Hakan Halil glad to hear it helped you :)
@SudhanshuKumar-jl8iw
@SudhanshuKumar-jl8iw 5 жыл бұрын
How can add video in django media
@ESWARAMOORTHYP-dq9ic
@ESWARAMOORTHYP-dq9ic 4 жыл бұрын
Bro how to add multiple images to this.
@hasib4joy
@hasib4joy 4 жыл бұрын
for python 3.8.2 with pycharm install the pillow with command given bellow. python -m pip install --upgrade pillow
@oorhood
@oorhood 3 жыл бұрын
You're the best
@yexiu1687
@yexiu1687 7 жыл бұрын
pls help why cant i display the images this time...it just pure white..
@prabuparamashivam3364
@prabuparamashivam3364 6 жыл бұрын
exception value : table articles_article has no column named thumb
@sathvikswaminathan7933
@sathvikswaminathan7933 5 жыл бұрын
Try deleting your migration files and then run the migration commands again
@vedprakash-bw2ms
@vedprakash-bw2ms 5 жыл бұрын
Image is appearing broken ?? And every time i select one image its copy with some extension is created.
@MaheshMV666
@MaheshMV666 5 жыл бұрын
You might be confused with url.py. We are adding the code in djangonautic/url.py. Not in articles/url.py.
@687r45dfg
@687r45dfg 4 жыл бұрын
The Image Is Not Being Showed In Django 3
@687r45dfg
@687r45dfg 4 жыл бұрын
@obet reyes can you give the last part is settings.py please
@687r45dfg
@687r45dfg 4 жыл бұрын
@obet reyes fine it's working now. i forgot to add .url in sytax and the correct is{{ article.thumnail.url}} == Correct
@nickiminaj0882
@nickiminaj0882 4 жыл бұрын
can u help me guys? i can't output the img. i did everything like in this tutorial but nothing happened((
@nirajs.golhar7609
@nirajs.golhar7609 4 жыл бұрын
what is the problem in detail
@rishabhverma6619
@rishabhverma6619 4 жыл бұрын
Yes I got the same tooo
@rishabhverma6619
@rishabhverma6619 4 жыл бұрын
The images are not showing there even not the default one
@nickiminaj0882
@nickiminaj0882 4 жыл бұрын
@@rishabhverma6619 i solved it somehow but i can't remember sorry😔😔😔 it was 6months ago😔
@rishabhverma6619
@rishabhverma6619 4 жыл бұрын
Can u share the github repository or something like that?!??
@SURJEETSINGH-ms9iu
@SURJEETSINGH-ms9iu 5 жыл бұрын
thanks alot bro :)
@RizwanAli-bu5oy
@RizwanAli-bu5oy 6 жыл бұрын
can anyone help me.. how to upload and store multiple images for a single record in database?
@jiechen3827
@jiechen3827 6 жыл бұрын
Hi, I am also looking for ways like this, did you solve this?
@michakwiatek5031
@michakwiatek5031 6 жыл бұрын
You can craete model to store only image with it's description etc. and then in your model where you want to have many images just add column: images = models.ManyToManyField('', models.on_delete=SET_NULL)
@ishikagarg5261
@ishikagarg5261 6 жыл бұрын
default image is not displaying . what to do ???
@garychan1967
@garychan1967 6 жыл бұрын
Download default.png: github.com/iamshaunjp/django-playlist/tree/lesson-17/djangonautic/media. Place image in media folder (not the assets folder) for example: C:\Users\Gary\project\python\django-playlist\djangonautic\media
@rishabhverma6619
@rishabhverma6619 4 жыл бұрын
Helpppp
@bintangpratomo8879
@bintangpratomo8879 4 жыл бұрын
github repository??
@NetNinja
@NetNinja 4 жыл бұрын
In the vid description!
@abhayraghuvanshi5199
@abhayraghuvanshi5199 7 жыл бұрын
Great man thanks, can you make a video of your setup tour :-p
@sntrdm
@sntrdm 7 жыл бұрын
thank you !
@CodeProps
@CodeProps 5 жыл бұрын
I ran out into trouble when I try to view my uploaded video/audio files in media url. Can someone help me solve this ? Here's the link to the question. stackoverflow.com/questions/59298331/error-in-django-when-i-play-uploaded-media-files-through-media-url
@bpospanov
@bpospanov 5 жыл бұрын
brilliant
@gururaj2199
@gururaj2199 4 жыл бұрын
I hope adding videos is the same
@rayansailani4465
@rayansailani4465 4 жыл бұрын
So no one here has an error in installing Pillow??
@rojansayami177
@rojansayami177 4 жыл бұрын
i do
@Lbmaniak
@Lbmaniak 6 жыл бұрын
thx
@Standupibrahimbackup
@Standupibrahimbackup 4 жыл бұрын
hate it when my girlfriend magaes me a lot
Django Tutorial #18 - Accounts App
10:12
Net Ninja
Рет қаралды 51 М.
How to Upload an Image Using Django ImageField (The RIGHT Way)
20:03
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Django Tutorial #12 - Static Files & Images
8:51
Net Ninja
Рет қаралды 152 М.
Introduction - Django File Upload Tutorial - Part 1
17:12
Vitor Freitas
Рет қаралды 201 М.
Django Tutorial #20 - Saving Users
12:19
Net Ninja
Рет қаралды 44 М.
Django Tutorial #5 - Django Apps
15:20
Net Ninja
Рет қаралды 107 М.
Django Part 6: Render "CSS", "JavaScript" and "Image" files
10:34