Upload Images To Django - Django Wednesdays #38

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024

Комментарии • 137

  • @Codemycom
    @Codemycom  2 года назад +2

    ▶️ Watch Entire Django Wednesdays Playlist ✅ Subscribe To My RUclips Channel:
    bit.ly/35Xo9jD bit.ly/2IGzvOR
    ▶️ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
    ▶️ Get The Code
    bit.ly/3sJpeV6

  • @kutayyildirim1160
    @kutayyildirim1160 Год назад +8

    It was so pleasing to learn Django Images from the greatest cook Heisenberg himself. Thanks!

  • @lone_wolf1015
    @lone_wolf1015 Год назад +2

    i was soooooooo stuck at the image uploading thing but thanks to your video i understood it as well as i resolved the issue .....thanks man ... love from pakistan

  • @edappalkkaran
    @edappalkkaran Год назад

    This really saved me. I had already lost 5+ hours fixing the issue of non displaying images saying url link not available. Watching this video helped me resolve my issue. Thank you.

  • @kadexdark
    @kadexdark Год назад +6

    You saved my day, man. Thanks a lot!

  • @erenyeager3657
    @erenyeager3657 Год назад +1

    man your video saved me
    after like 3 hours searching on stakeoverflow your tutorial helped with the idea of linking the image to the user with getting the "venue =save(commit=False)" and then assigning to venue.user
    thank you sir

    • @Codemycom
      @Codemycom  Год назад

      Glad you got it sorted out!

  • @vanshjangid9782
    @vanshjangid9782 2 года назад +4

    Your BIG FAN

  • @crcacom
    @crcacom 2 года назад +2

    Thank you. I was searching a simple example like this, about a field image in Django. Thanks!

  • @BijouBakson
    @BijouBakson 5 дней назад

    All these steps just to upload an image huh! Django really is Flask on double steroids. Thank you for sharing :)

  • @user-oq3np1ud8q
    @user-oq3np1ud8q 2 года назад +5

    How can we to limit the size of the attached file/image in django? I mean as example not more than 3MB or something like this?

  • @Dante-nu5cn
    @Dante-nu5cn Год назад

    Thank you! I've spent so long looking for a solution to this

  • @nazariyholovach9350
    @nazariyholovach9350 Год назад

    Thanks bro, you're the best teacher

  • @rivalinodianramadhan8247
    @rivalinodianramadhan8247 7 месяцев назад

    thanks a lot sir!!

  • @emircanozturk3770
    @emircanozturk3770 Год назад

    thanks a lot mr.white

  • @sithuhtun3609
    @sithuhtun3609 2 года назад +1

    Nice! I really love Django😍

  • @DarkCloud0000
    @DarkCloud0000 2 года назад

    Thank you so much bro, you saved my life :)

  • @sargismnoyan5211
    @sargismnoyan5211 Год назад

    you are a great professor

  • @fluke_8431
    @fluke_8431 Год назад

    very good video. i dont speak english but I understand very much!!! 😀👍👍 very helpful

  • @k4rn31ro8
    @k4rn31ro8 11 месяцев назад

    WOAH IT WORKED
    THANKS (A LOT)

    • @Codemycom
      @Codemycom  11 месяцев назад

      glad to hear it

  • @JuanCarlos-kr9dd
    @JuanCarlos-kr9dd Год назад

    Finally!!! A solution! Thanks Jhon!!!

  • @nowfeelsafi9595
    @nowfeelsafi9595 11 месяцев назад

    clear and useful, thanks a lot

    • @Codemycom
      @Codemycom  11 месяцев назад

      Happy to help!

  • @EzaguiDark
    @EzaguiDark Год назад

    thanks, this helps me in my learning journery xd

  • @odasflex
    @odasflex 5 месяцев назад

    thank you for this

  • @yanabrigadir
    @yanabrigadir Год назад

    thank you so much, bro

  • @josevictor367
    @josevictor367 Год назад

    Muito obrigado
    AVANTI PALESTRA!!!

  • @user-yu7im4rk2q
    @user-yu7im4rk2q 2 года назад

    thanks man. best tutorial!

  • @babaksolhjoo
    @babaksolhjoo Год назад

    Amazing set of videos.... Well done... Congrats....
    Could you please also put a video on how we can upload a file or image with time stamp field in DB?
    I mean a case in which user only needs to insert image but the application also stores the upload time as well in db.

  • @RahulRaj-rh9ol
    @RahulRaj-rh9ol 3 месяца назад

    Thank you

  • @lilrock6734
    @lilrock6734 2 года назад

    Perfect!!! Tanks man!

  • @alejandrokroma8511
    @alejandrokroma8511 2 года назад

    thank !!! it was really helpful for me

  • @ericzheng4815
    @ericzheng4815 Год назад

    Good one

  • @smol5601
    @smol5601 8 месяцев назад

    You just earned a sub

  • @nnorse
    @nnorse Год назад

    nice video, saved my life

  • @anders21karlsson
    @anders21karlsson 2 года назад

    Very nice video. Thank you! 👍🏿

  • @ahmedghallab5342
    @ahmedghallab5342 Год назад

    شكرا thanks

  • @user-qk3ey6tb1k
    @user-qk3ey6tb1k 2 года назад

    thank you man!

  • @user-dt5ci3hy8q
    @user-dt5ci3hy8q Год назад

    Amazing tutorial sir, you saved my life, and can I use this method in production

  • @deki90to
    @deki90to 2 года назад +2

    I know it's not realted with your schedule, but, I found this new thing HTMX really usefull in django, will you explaine it maybe in future? It's soo good to know that we can focus on django and html only

  • @justpi1957
    @justpi1957 Год назад

    the image doesn't reflect in the db even though there are no typo, the multipart is correctly spelled. what you think is the problem?

  • @GreyEyedAthena
    @GreyEyedAthena Год назад

    thanks

  • @napo5730
    @napo5730 10 месяцев назад

    Thanks for the great video. I'm badly stuck though. Suppose I serve large files like gigabytes in size. I have a download server which allows only FTP file uploads. How can I configure my django application to upload media files to the other server (which is located on another machine) and then serve files from there?

  • @hkspiderfret3187
    @hkspiderfret3187 9 месяцев назад

    is there a way to upload the same image to two different models.ImageFields? one for header_image and one for thumbnail?

  • @eduardocardoso6286
    @eduardocardoso6286 Год назад

    Hello John.
    I hope you are well.
    How different is uploading a file from this example?
    Its just change the ImageField to a FileField ?
    Thank you, once again!

  • @nzueessonoyannis1327
    @nzueessonoyannis1327 Год назад

    OMG thank you

  • @mohamadhadisaid6603
    @mohamadhadisaid6603 2 года назад +1

    Would you recommend me to read a book : (building android apps in python using kivy with android studio with pyjnius plyer and buildozer)
    or just take a kivy course

    • @Codemycom
      @Codemycom  2 года назад +1

      Do whatever you like :-p or both

  • @abyssinia_entertainment
    @abyssinia_entertainment 2 года назад

    how to insert images directly to database in blob data type, and when delete the data in database in admin site the image is not deleted in media/images folder , how to fix?

    • @Codemycom
      @Codemycom  2 года назад

      Most hosting providers don't allow that anymore. You have to upload your images to a cdn and reference the URL in your database

  • @shankar66
    @shankar66 Год назад

    i mean when i upload one file it went to django server. then from there it went to s3. and in this last step it takes a long time to get response that your file is uploaded. so i was thinking if we use celery we don't need to wait further to upload to s3 to get response. it will automatically upload the file in background to s3 after we upload it from user end.

  • @amirhossein4554
    @amirhossein4554 2 года назад

    When I add the url, the error "attribute has no file associated with it". Appears

  • @code-snippets
    @code-snippets 2 года назад

    I wonder how can we setup media configuration with pathlib

  • @reybelediano4452
    @reybelediano4452 2 года назад

    did you load the static in the template prior to this video? because, I can't seem to display the image in the template. Advance thanks for the response. Great tutorial BTW.

    • @Codemycom
      @Codemycom  2 года назад

      Possibly, I don't remember...go watch and see.

  • @Kennerdoll
    @Kennerdoll 2 года назад

    Thanks once again i struggled to deal with media

  • @ngc918
    @ngc918 Год назад

    Hi there. Would there be a reason why MEDIA_URL or MEDIA_ROOT wouldn't show up right after I typed settings. ? I've been trying to figure out this problem for a while now. Any help would be appreciated!

    • @Codemycom
      @Codemycom  Год назад +1

      They'll only show up after the first time someone uploads an image. It's the uploading of the image that triggers the creation of the directory.

  • @mohammedbakkari3090
    @mohammedbakkari3090 9 месяцев назад

    hi, I have a question please
    I want to share an image from my laptop to tablet (without touching in the tablet).
    if I changed the image on my laptop it must change in the tbalet.
    thanks in advance

    • @Codemycom
      @Codemycom  9 месяцев назад +1

      Sorry, that's not possible or related in anyway to this video...

    • @mohammedbakkari3090
      @mohammedbakkari3090 9 месяцев назад

      Thank you so much for your quick response. Best wishes

  • @AniketMax
    @AniketMax 2 года назад

    will this work on Heroku or my statics file will be deleted.

  • @gumboot48899
    @gumboot48899 Год назад

    Love your videos. Could you make a video for the following? Is there a way with Django to upload multiple PDF files at once from the webpage via a form, convert them into an image format (PNG, JPEG, etc.), then save only the images to the media directory and only the images URLs to a "image" Model then delete the PDF versions of all the files all together?

    • @Codemycom
      @Codemycom  Год назад

      There's no default mechanism in Django to do that, you'd have to do quite a bit of hacking to get that done.

    • @gumboot48899
      @gumboot48899 Год назад

      @@Codemycom what about just how to upload multiple files/images at once?

  • @Conormcnproductions
    @Conormcnproductions 2 года назад

    I'm a little confused about something (also after looking at the official documentation). The images are working in html...but only when I set debug = True in the settings py script. When I set debug = False, the images from ImageField are all dead. I don't know what to do, I tried the csrf_exempt decorator but it didn't change anything. Is this normal? I wish the documentation would explain more.

    • @brycesoto6818
      @brycesoto6818 Год назад

      Hey! Im having the same issue. Any idea on a fix?

  • @407rutujashastri3
    @407rutujashastri3 Год назад

    How to upload Videos?? Pleasee can someone tell

  • @jerouespelita6760
    @jerouespelita6760 2 года назад

    Hi! I followed your steps but I still can't view the image that I uploaded. I receive this whenever I click the image file "The requested resource was not found on this server."

    • @Codemycom
      @Codemycom  2 года назад

      You'll have to rewatch the video and try to figure out what you missed.

  • @subho01717
    @subho01717 2 года назад

    Sir, we are missing your two video. Those are hidded I beleive...39 & 40. Are we elligible for those two?

    • @Codemycom
      @Codemycom  2 года назад +1

      We haven't gotten that far. This is the latest video, they come out every Wednesday

  • @reelycoding
    @reelycoding 2 года назад

    I made a django-cookiecutter docker project where users can upload an avatar but when I put it on a digital oceans Ubuntu server the edit form saves image path and not the image itself to the media folder. It causes a 500 error for file not found and breaks every page where the file is referenced. Anyone have any advice?

    • @Codemycom
      @Codemycom  2 года назад

      Hosting services usually don't let you upload images to a database. You need to use a cdn.

  • @mohamedfahim8183
    @mohamedfahim8183 2 года назад

    Hey did everything you said but still the image doesn't upload. It uploads but doesn't show either in the website nor the media file is created automatically
    Also creating manually doesn't work the media file
    Pls can I have a fast reply

    • @Codemycom
      @Codemycom  2 года назад

      Then no, you didn't do everything I said. Try rewatching the video again and try to catch what you missed the first time.

    • @mohamedfahim8183
      @mohamedfahim8183 2 года назад

      @@Codemycom yeah got it wrong config of db

  • @user-yf4vl2rp8u
    @user-yf4vl2rp8u Год назад

    Thank you! Is it possible to upload many pictures and then show all of them?

    • @Codemycom
      @Codemycom  Год назад

      Sure, but I don't have any videos on that.

    • @austinematurure1512
      @austinematurure1512 Год назад

      Hi did you figure out how to do this? I need help

    • @user-yf4vl2rp8u
      @user-yf4vl2rp8u Год назад

      @@austinematurure1512 I made it, but not as cautiously as I wanted ---- I decided make uploading image an adding it to some list of images... If you'll find a better option -- let me know :)

    • @austinematurure1512
      @austinematurure1512 Год назад

      @@user-yf4vl2rp8u I found a way but you'll have to upload the images one by one

  • @SurajPrajapatiu8
    @SurajPrajapatiu8 2 года назад

    4.0 django error time zone not found please solve this problem

    • @Codemycom
      @Codemycom  2 года назад

      That's not what this video is about, we're not using 4.0 here

  • @shankar66
    @shankar66 Год назад

    sir when i upload big files it takes time. can you make a video to upload large files to s3 using celery or something like that so that the user need not wait.

    • @Codemycom
      @Codemycom  Год назад

      Upload speeds depend on the users internet connection. Not on S3 etc.

    • @shankar66
      @shankar66 Год назад

      i mean when i upload one file it went to django server. then from there it went to s3. and in this last step it takes a long time to get response that your file is uploaded. so i was thinking if we use celery we don't need to wait further to upload to s3 to get response. it will automatically upload the file in background to s3 after we upload it from user end.

  • @itskwn6973
    @itskwn6973 2 года назад +1

    hey jhon 3rd like 🤩

  • @bytecodeversity
    @bytecodeversity 2 года назад

    How to deal with this ?
    WARNINGS:
    ?: (staticfiles.W004) The directory 'C:\Users\HP\PythonProjects\django\src\static' in the STATICFILES_DIRS setting does not exist.

    • @Codemycom
      @Codemycom  2 года назад

      It's telling you that the directory doesn't exist. You've made an error in your code. what is src? Why is it looking for that?

    • @paulbrugger9610
      @paulbrugger9610 Год назад

      I am using Django 4.14. In the settings.py file, I commented out the STATICFILES_DIRS line and this same migration error went away and I was able to finish this lesson without a problem. Apparently this line is not needed?

  • @stanimirpetrov4823
    @stanimirpetrov4823 2 года назад

    This is on the development environment only. You can't upload images on production like that.

    • @Codemycom
      @Codemycom  2 года назад

      Sure you can

    • @AniketMax
      @AniketMax 2 года назад

      @@Codemycom I tried it with DEBUG = False, and suddenly it cant access images

    • @og_ashura
      @og_ashura Год назад

      I am currently experiencing same issue, I cant upload or view the images after I change debug to false. Please can you guide me on how you fixed this

  • @XxLechovarrzLOLxX
    @XxLechovarrzLOLxX Год назад

    Jesse... We need to code...

  • @EmadSaeed
    @EmadSaeed 2 года назад

    Man, thank u but please get to the point directly

    • @Codemycom
      @Codemycom  2 года назад +1

      Oh, is the 14 minute free video that teaches you exactly what you need not fast enough for you? I have no patience for that sort of whiny entitlement. Go watch someone else's videos.

  • @mirtz5762
    @mirtz5762 2 года назад

    Thanks but I need help, when I run the makemigrations I have this error:
    File "/code/docker_django/unidepApp/urls.py", line 14, in
    ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    File "/usr/local/lib/python3.7/site-packages/django/conf/urls/static.py", line 22, in static
    raise ImproperlyConfigured("Empty static prefix not permitted")
    django.core.exceptions.ImproperlyConfigured: Empty static prefix not permitted