Django Tutorial #17 - Uploading Media

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 98

  • @lasmenso
    @lasmenso 6 років тому +5

    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.

  • @ScumbagKonflict
    @ScumbagKonflict 4 роки тому +2

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

  • @leaningtower73
    @leaningtower73 8 місяців тому +4

    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

  • @rishabhverma6619
    @rishabhverma6619 3 роки тому +2

    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

  • @skalippanbalippan6972
    @skalippanbalippan6972 6 років тому +1

    Best django tutorial in the planet. you didn't lie about this

  • @srinivasr5567
    @srinivasr5567 6 років тому +6

    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 років тому +1

      we really need that bro. django + vue

  • @DuongTran-zh6td
    @DuongTran-zh6td Рік тому

    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 = ...............

  • @madusan1
    @madusan1 6 років тому +11

    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 2 роки тому

    Really simple explanation. Thank you

  • @toctoc4964
    @toctoc4964 5 місяців тому

    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.

  • @wisamkhalid5663
    @wisamkhalid5663 6 років тому +1

    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.

  • @johnjim3741
    @johnjim3741 10 місяців тому

    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

  • @asylbekbekmurzaev6098
    @asylbekbekmurzaev6098 3 роки тому

    Thank you brother, you did a great job!

  • @malikbrahimi7504
    @malikbrahimi7504 4 роки тому +1

    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.

  • @HasoVids
    @HasoVids 4 роки тому +1

    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.

  • @sort_to_see_hidden_comments
    @sort_to_see_hidden_comments 2 роки тому

    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

  • @yashv2000
    @yashv2000 4 роки тому +1

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

  • @yatharthmanchanda8594
    @yatharthmanchanda8594 Рік тому

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

  • @hasib4joy
    @hasib4joy 4 роки тому +1

    for python 3.8.2 with pycharm install the pillow with command given bellow.
    python -m pip install --upgrade pillow

  • @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?

  • @arpitgupta1876
    @arpitgupta1876 6 років тому +1

    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

  • @taihatranduc8613
    @taihatranduc8613 5 років тому

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

  • @SantoPapaVaticano
    @SantoPapaVaticano 6 років тому +2

    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 5 років тому +5

      @@AxmedShiimax Please remove the , in the end of the code in settings. if we put , it automatically takes as a tuple.

    • @menjaholmwettergren5058
      @menjaholmwettergren5058 5 років тому +1

      Thanks I got the same error and your answer was the solution

  • @AbhishekKumar-mq1tt
    @AbhishekKumar-mq1tt 6 років тому

    Thank u for this awesome video.

  • @tusharraina8423
    @tusharraina8423 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

  • @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 5 років тому +1

      He says just that at 8:10 in the movie. He even mistypes it first so he has to do it twice =)

    • @danielfurey3081
      @danielfurey3081 5 років тому +1

      Ah, thanks so much. I must have missed that.

    • @Alkanen
      @Alkanen 5 років тому +1

      @@danielfurey3081 no worries, it happens. God knows I miss most of the details in anything I watch :D

  • @hasifibrahim5846
    @hasifibrahim5846 4 роки тому

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

  • @aXimo
    @aXimo 4 роки тому

    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 4 роки тому

      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

  • @SURJEETSINGH-ms9iu
    @SURJEETSINGH-ms9iu 5 років тому +1

    thanks alot bro :)

  • @yexiu1687
    @yexiu1687 6 років тому

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

  • @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 років тому +1

      You might be confused with url.py. We are adding the code in djangonautic/url.py. Not in articles/url.py.

  • @nadimhayat3412
    @nadimhayat3412 4 роки тому

    The png files aren't displaying properly on the website. What should i do?

  • @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

  • @oorhood
    @oorhood 3 роки тому

    You're the best

  • @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?

  • @abhayraghuvanshi5199
    @abhayraghuvanshi5199 6 років тому

    Great man thanks, can you make a video of your setup tour :-p

  • @687r45dfg
    @687r45dfg 4 роки тому +1

    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

  • @sntrdm
    @sntrdm 6 років тому

    thank you !

  • @prabuparamashivam3364
    @prabuparamashivam3364 5 років тому

    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

  • @ESWARAMOORTHYP-dq9ic
    @ESWARAMOORTHYP-dq9ic 3 роки тому

    Bro how to add multiple images to this.

  • @cuteness8780
    @cuteness8780 4 роки тому

    Hey .. Good video ..any tutorial for image gallary from youtube

  • @bpospanov
    @bpospanov 4 роки тому

    brilliant

  • @SudhanshuKumar-jl8iw
    @SudhanshuKumar-jl8iw 4 роки тому

    How can add video in django media

  • @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

  • @nickiminaj0882
    @nickiminaj0882 4 роки тому +1

    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 3 роки тому

      Yes I got the same tooo

    • @rishabhverma6619
      @rishabhverma6619 3 роки тому

      The images are not showing there even not the default one

    • @nickiminaj0882
      @nickiminaj0882 3 роки тому

      @@rishabhverma6619 i solved it somehow but i can't remember sorry😔😔😔 it was 6months ago😔

    • @rishabhverma6619
      @rishabhverma6619 3 роки тому

      Can u share the github repository or something like that?!??

  • @Lbmaniak
    @Lbmaniak 5 років тому

    thx

  • @bintangpratomo8879
    @bintangpratomo8879 3 роки тому

    github repository??

    • @NetNinja
      @NetNinja  3 роки тому

      In the vid description!

  • @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 5 років тому

      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)

  • @gururaj2199
    @gururaj2199 4 роки тому

    I hope adding videos is the same

  • @ishikagarg5261
    @ishikagarg5261 6 років тому

    default image is not displaying . what to do ???

    • @garychan1967
      @garychan1967 5 років тому

      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 3 роки тому

      Helpppp

  • @rayansailani4465
    @rayansailani4465 4 роки тому +1

    So no one here has an error in installing Pillow??

  • @CodeProps
    @CodeProps 4 роки тому

    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

  • @Standupibrahimbackup
    @Standupibrahimbackup 4 роки тому +1

    hate it when my girlfriend magaes me a lot