How To Upload Images With Django - Django Blog #26

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ส.ค. 2024
  • In this video I'll show you how to upload images using Django.
    We'll set up the ability to upload a header image for each blog post. Uploading images with Django is pretty simple, we need to add a field to our database model, then make a quick change to our settings.py file, and our original urls.py file. Then tweak our blog post form, and the blog post page itself.

ความคิดเห็น • 201

  • @Codemycom
    @Codemycom  4 ปีที่แล้ว +4

    ▶️ Watch Entire Django Blog Playlist ✅ Subscribe To My TH-cam Channel:
    bit.ly/3bWN6wj 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

    • @Talhakhhaan
      @Talhakhhaan 3 ปีที่แล้ว

      Can you share the code?

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +4

      @@Talhakhhaan github.com/flatplanet/djangoblog

    • @ulearnacademy5866
      @ulearnacademy5866 3 ปีที่แล้ว

      @@Codemycom Thank you so much for this

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      @@ulearnacademy5866 welcome!

  • @jimmyopot1972
    @jimmyopot1972 3 ปีที่แล้ว +10

    dear sir, this is 2021 and for some reason, static files with Django give me a lot of headaches...this video has literally helped me understand it, thank you so much.

  • @nyikongwenya9934
    @nyikongwenya9934 4 ปีที่แล้ว +14

    Hi , can you please show to upload several images . Great videos

  • @kelvinmacharia3715
    @kelvinmacharia3715 ปีที่แล้ว +1

    Being looking forward to this tutorial and so I had to upload my face to make feel even better🤣🤣

  • @prathvisingh8288
    @prathvisingh8288 3 ปีที่แล้ว +1

    Thanks a million man...I was struggling for hours to achieve this!

  • @jlyricks
    @jlyricks 3 ปีที่แล้ว +1

    Hello @Codemy i just wanted to said thank you for your very good tutorial. i was in a very difficult situation and it help me. (excuse for my bad english. i'm Francophone)

  • @golammuhaimeen2825
    @golammuhaimeen2825 2 ปีที่แล้ว

    thank you so much for this amazing video! seriously. I had to watch 3-4 other trash ones before coming across this one. perfectly explained fam!

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Glad you liked it!

  • @NOTHING-en2ue
    @NOTHING-en2ue ปีที่แล้ว

    i was searching for this tutorial thanks a lot

  • @sithuhtun3609
    @sithuhtun3609 3 ปีที่แล้ว +1

    John, your tutorials are awesome!

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Glad you like them!

  • @sandipsky8756
    @sandipsky8756 4 ปีที่แล้ว +1

    really awesome and helpful. love to see more django projects tutorials in the future ❤❤

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +2

      More to come!

  • @963seeker
    @963seeker ปีที่แล้ว

    Chatgpt couldn't solve this for me, thank you!

  • @hemalpatel3770
    @hemalpatel3770 3 ปีที่แล้ว

    straight to point & into the brain thanks man!

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Sure thing!

  • @vivekshotti
    @vivekshotti 3 ปีที่แล้ว +1

    hey, codemy (john elder), your django course is lit. Thank you.

  • @zantron702
    @zantron702 4 ปีที่แล้ว

    The app is already awesome. Would be a nice feature to have a comment section for blog entries.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Will likely do comments in the future

  • @MariusOdobasa
    @MariusOdobasa 4 ปีที่แล้ว

    I managed to understand Django thanks to you!

  • @protozvezda
    @protozvezda 2 ปีที่แล้ว

    That was awesome! What is more important - it worked for me!
    Liked and Subscribed!

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Thanks for the sub!

  • @gamehamster9379
    @gamehamster9379 3 ปีที่แล้ว +1

    Спасибо тебе, мужик!

  • @kaushalniroula4129
    @kaushalniroula4129 4 ปีที่แล้ว

    Thanks....it worked...finally...due to you....I was quite stuck

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Glad to hear that

  • @naseathsaly
    @naseathsaly 3 ปีที่แล้ว

    Thanks you it save my time

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Happy to hear it!

  • @anusri1886
    @anusri1886 3 ปีที่แล้ว

    easy to understand. Awesome tutorial

  • @fajar3972
    @fajar3972 3 ปีที่แล้ว +1

    Good explanation, so easy to understand. Thank you so much sir :D

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Most welcome!

  • @pierrelesage1535
    @pierrelesage1535 2 ปีที่แล้ว

    thanks John!

  • @stevemulcahy5014
    @stevemulcahy5014 ปีที่แล้ว

    This is great! What is the best way to handle multiple images though? I don't really want to restrict the amount of images, but kind of hate hard coding in image1...image4 in my posts model.
    One other thing I've been using is imagekit to resize the image to something web friendlier and even for the header image to make a banner image. I'm a devops engineer (with a history of ops rather than dev) and your videos are helping me understand - and be inspired by - django and Python.

  • @victorsova7045
    @victorsova7045 3 ปีที่แล้ว

    You are the best

  • @sagarchoubey8653
    @sagarchoubey8653 2 ปีที่แล้ว +1

    General Feedback: It would be better to show the function through which the template is called where you were displaying the form.

  • @DanielGutierrez3007
    @DanielGutierrez3007 2 ปีที่แล้ว

    Danr bro, you are keeping me the star at work.

  • @sergey5551
    @sergey5551 3 ปีที่แล้ว

    good tutorial

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Glad you think so!

  • @haimeiwang742
    @haimeiwang742 3 ปีที่แล้ว

    Very helpful. Thanks a lot!

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Happy to hear it!

  • @donnewquist6990
    @donnewquist6990 3 ปีที่แล้ว +1

    You're the coolest nerd I never met...

  • @samucancld
    @samucancld 2 ปีที่แล้ว

    Gracias dolape

  • @sherryjoseph7571
    @sherryjoseph7571 3 ปีที่แล้ว

    awesome video - really helped me out!

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Happy to hear it!

  • @GabrielRPalma
    @GabrielRPalma 4 ปีที่แล้ว

    Thanks very much for your videos !

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      You're welcome!

  • @GreyEyedAthena
    @GreyEyedAthena ปีที่แล้ว

    thank you

  • @lckhndleup
    @lckhndleup 2 ปีที่แล้ว

    thank you so much . ıt solved my problems

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Happy to hear it!

  • @City__Walker
    @City__Walker ปีที่แล้ว

    I have problem how add multiple upload images functionality in this example

  • @x-tremeprogrammer
    @x-tremeprogrammer ปีที่แล้ว +1

    What about multiple images??

  • @colonnaden
    @colonnaden 3 ปีที่แล้ว +3

    This video would have been perfect.... Only if you had showed the view where you did request. FILES

  • @rangabharath4253
    @rangabharath4253 4 ปีที่แล้ว

    Awesome as always

  • @chelseafan2893
    @chelseafan2893 3 ปีที่แล้ว +2

    how to upload multiple images using one button only?

  • @robh9184
    @robh9184 4 ปีที่แล้ว

    Nice one John! This is a useful tool

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Thanks! Glad you like it!

  • @CesarBArts
    @CesarBArts 2 ปีที่แล้ว

    I don't know why, but i can use post.image.url in django template only if i put IF statement before my

  • @rahamanhabib1347
    @rahamanhabib1347 4 ปีที่แล้ว

    As always Great!!!

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Thanks again!

  • @ufukcicek9976
    @ufukcicek9976 11 หลายเดือนก่อน

    Hello,
    I also use Editorjs in my project.
    But I have a problem, I can save images and files in the editor in my local, but when I deeploy the project, I get an error. It says it can't find the file. I searched a lot but couldn't find a solution.
    Do you have any idea about this topic?

  • @dradrigapatrick
    @dradrigapatrick 3 ปีที่แล้ว

    Very great!!

  • @robertochieng8115
    @robertochieng8115 3 ปีที่แล้ว

    Thank you Big Bro

  • @zinlinhtun1510
    @zinlinhtun1510 4 ปีที่แล้ว +2

    hello sir, if possible, Please share how to upload multiple images to our blog post...

  • @fabiof.deaquino4731
    @fabiof.deaquino4731 4 ปีที่แล้ว

    Thanks again and time again :)

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Glad you're enjoying them!

  • @azarsirdash
    @azarsirdash 3 ปีที่แล้ว +2

    thank you for the video,
    I watched and applied step by step
    ,
    but the picture doesn't save from the form in templated
    but in the admin page can save image and finally .
    The solution:
    add request.FILES in the views.py file. in place form = CreatePostForm (request.POST)

    • @beardtreasure
      @beardtreasure 3 ปีที่แล้ว

      Wish you good health, creative inspiration, of your professional plans, and all personal desires and dreams.

  • @nami_academy2024
    @nami_academy2024 3 ปีที่แล้ว

    am having this error Exception Value:
    The 'header_image' attribute has no file associated with it.

  • @Ian-bb7vv
    @Ian-bb7vv 3 ปีที่แล้ว +3

    hey John, thank you for all the wonderful videos that you made, i really benefit a lot from them. But i think whren you are going to do the code in views.py, you need to use
    form = whateverform(request.POST, request.FILES) instead of just rquest.POSTright?

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      what makes you say that?

    • @Ian-bb7vv
      @Ian-bb7vv 3 ปีที่แล้ว

      im thinking maybe the request.POST does not include image files? BTW im sending .jpg files in this project.

    • @Ian-bb7vv
      @Ian-bb7vv 3 ปีที่แล้ว

      im still learning so not sure why that is happening though

    • @jeanpaulrodriguezflores2398
      @jeanpaulrodriguezflores2398 ปีที่แล้ว

      U are rigth man u need to ruse request.POST and request.FILES. I was struggling a lot with these

  • @viswamberprasad9418
    @viswamberprasad9418 3 ปีที่แล้ว +4

    I was coding along with this video,but for some reason,my image wouldnt be uploaded in Django.
    when i checkd in the admin section,it always showed 'no files chosen',i checked every line of code again,rewatched the video,but couldnt get around the error,later after surfing the net for a while,i have found the solution.
    If you are facing the same error,then please change your views.py file
    when you create an instance of the form in your views.py file,accept it as
    form=ExampleForm(request.POST,request.FILES)
    the request.FILES is important.
    John kindly pin this comment,or add a comment yourself,to help those who are scratching their heads,trying to solve this issue,like I did

    •  3 ปีที่แล้ว +1

      Thanks for your sharing solution, much appreciated

    • @kaykwame7629
      @kaykwame7629 3 ปีที่แล้ว +1

      Thank you for sharing I was having the same problem.

    • @talhaeser2840
      @talhaeser2840 3 ปีที่แล้ว +1

      thank you so much

    • @the_proton_guy
      @the_proton_guy 2 ปีที่แล้ว +1

      My God! You just brought me out of my misery. Thank you soo much

  • @killcam8071
    @killcam8071 2 ปีที่แล้ว

    yes

  • @akashbhalotia317
    @akashbhalotia317 3 ปีที่แล้ว

    Thanks man.

  • @harshvardhanp6184
    @harshvardhanp6184 3 ปีที่แล้ว

    Thanks bro.... 👍👍👍

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Welcome 👍

  • @manavprajapati1469
    @manavprajapati1469 3 ปีที่แล้ว

    what if user not upload image , if we want that user have to upload image , how to do it

  • @animeshsingh4290
    @animeshsingh4290 3 ปีที่แล้ว +3

    Quick Solution for anyone who is able to upload the file in the form but the image does not show up. In your views.py, whatever functions is handling the form validity. Add request.FILES to the form for it to work.
    def create(request):
    if request.method == 'POST':
    form = listingForm(request.POST, request.FILES)
    ....

    • @ponishbhatia9807
      @ponishbhatia9807 3 ปีที่แล้ว +1

      THANKS A TON

    • @handyscenario178
      @handyscenario178 3 ปีที่แล้ว

      BRO thank you so much, I was trying to debug this for literally 2 hours

  • @shawnbeans7389
    @shawnbeans7389 3 ปีที่แล้ว +1

    Images, I like images...

  • @amponsahclinton7624
    @amponsahclinton7624 ปีที่แล้ว

    Hello sir how can I add the image selected to display on home.html

  • @francineamberfortes4138
    @francineamberfortes4138 3 ปีที่แล้ว

    what if multiple image?

  • @the_proton_guy
    @the_proton_guy 2 ปีที่แล้ว

    I have watched this tutorial a dozen times at this point. I have followed each step but the images do not seem to be uploading to the database. I need help!!

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Don't know what to tell you...you skipped something.

  • @amargupta8881
    @amargupta8881 3 ปีที่แล้ว

    Saved My Life :-)

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Glad to be helpful!

  • @jakobfredriksson2272
    @jakobfredriksson2272 4 ปีที่แล้ว

    At 13:00 I felt like John Carmack because I noticed it earlier in the video.

  • @jiffylab
    @jiffylab 2 ปีที่แล้ว

    Hi! This truly helped a lot. However, when I updated my blog and cleared the image then try to update the blog again with another photo, it won't accept it anymore. Any idea how to fix that? Thanks.

  • @abdullahhazari918
    @abdullahhazari918 3 ปีที่แล้ว

    I have some problem. When im creating post and add photo everythink is fine. But when i delete photo (using form) and after that trying to add it again photo does not come back. Its work by admin section but not from form. Can you help me sir.

  • @meditationmusic5934
    @meditationmusic5934 3 ปีที่แล้ว

    how to update blog images???

  • @TechWithSabri
    @TechWithSabri 2 ปีที่แล้ว

    Hi Sir;
    I hope you are doing very well
    first of all, thank you so much for:
    Time.
    Effort.
    Simplicity.
    Discipline.
    And when i'm watching your videos, a question came to my mind:
    Why you don't use an editor like PyCharm or Visual Studio.
    What is special for Sublime text?
    Again, thank you.
    I will text you when i finish this Tutorial
    We love you

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว +1

      Sublime text is free, easy to use, requires no configuration, and always works. Those other tools don't always work, require configuration, and can be impossible for newer coders to figure out.

  • @fatemeakrami8216
    @fatemeakrami8216 3 ปีที่แล้ว

    thanks for your helpful video , but where can I see the view of these post adding (specially the image adding ) ??

  • @jakespeers6835
    @jakespeers6835 3 ปีที่แล้ว

    Hey John, I'm a member on your site but oddly enough didn't see this series there! Anyway, great series, but was wondering if theres any chance you can make a video showing how to automatically upload photos to AWS S3 or some other NGINX host for production sites? Would help a lot! Thanks!

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Not a terrible idea

  • @sandipsandal
    @sandipsandal 4 ปีที่แล้ว

    hi! how can I upload image without using :- forms.py and and their function
    I simply create a signup form using html
    and I create extra model: and add in contact and image file (in User detail)
    but contact save in User db but image not being saved.....
    any suggestions for me
    Help me

  • @toluwanimiadeyemo8099
    @toluwanimiadeyemo8099 4 ปีที่แล้ว

    Great video
    I tried uploading a video file
    It's giving me some challenge

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      yeah video is tricky

  • @FarhanAhmed1360
    @FarhanAhmed1360 3 ปีที่แล้ว +1

    I exactly following your tutorial step by step and now getting this error "The header_image attribute has no file associated with it

    • @FarhanAhmed1360
      @FarhanAhmed1360 3 ปีที่แล้ว +1

      The problems gone after delete old post

    • @mrbuslov
      @mrbuslov 3 ปีที่แล้ว +1

      @@FarhanAhmed1360 Oh GOD, thanks you for this solution! I've been solving this problem for 2 days! You really helped me

  • @musabmohammed7973
    @musabmohammed7973 2 ปีที่แล้ว

    I am searching for a way to detect ID card.

  • @momothiam
    @momothiam 4 ปีที่แล้ว

    Hi, I can add picture directly from the blog app but it doesn't show the file on my admin page. but when I do the reverse, I get the picture on the blog post app. Can you help me plz. I like the way you explain things(straight to the point and clear).

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Sorry I'm not really sure what you mean. Did you add the model to the admin area?

    • @momothiam
      @momothiam 4 ปีที่แล้ว

      @@Codemycom Yes I did. I followed all the steps one by one but I am getting this error msg.
      File "C:\Users\......\mysite\lib\site-packages\django\db\models\fields\files.py", line 38, in _require_file
      raise ValueError("The '%s' attribute has no file associated with it." % self.field.name)
      ValueError: The 'header_image' attribute has no file associated with it.
      [23/Aug/2020 16:30:46] "GET /post/28/ HTTP/1.1" 500 161540

    • @momothiam
      @momothiam 4 ปีที่แล้ว

      @@Codemycom The error happens when I try to add the image src onto my post_detail.html templates.
      this is how I have it formulated:
      I did add the model to the admin area.
      from django.contrib import admin
      from .models import Post, Comment
      # Register your models here.
      admin.site.register(Post)
      admin.site.register(Comment)

  • @pandurangasharmaramaka
    @pandurangasharmaramaka 2 ปีที่แล้ว

    Thank you John! I am learning Django from your videos in my 53 years of age though I am teacher in Telugu (a South Indian language) with 'zero' knowledge in computers.
    The posts without image are showing message
    " The 'header_image' attribute has no file associated with it. " Can you suggest please.

    • @pandurangasharmaramaka
      @pandurangasharmaramaka 2 ปีที่แล้ว

      Thank you John,
      I found solution!!! tried the bellow one --
      {% if post.header_image %}

      {% endif%}

  • @stelity
    @stelity 3 ปีที่แล้ว

    what if you don't want to use {{ form.as_p }} and want to do a custom form? What would you type in the html and views.py?

    • @PhillyEastSide
      @PhillyEastSide 3 ปีที่แล้ว

      Hey, not sure if you have found a way around it yet. But I had a similar issue and I fixed it by doing the following in my .HTML template file:
      Title of route:{{ form.title }}
      Tags:{{ form.title_tag }}
      Country where crag/route can be found: {{ form.country }}
      Climbing grade(French system):{{ form.grades }}
      Route guide/Beta:{{ form.body }}
      I am building a blog for rock climbing and I wanted to add a bit more explanation for the required fields. so instead of calling {{form.as_p}} you just use {{form.x}} (x being = whatever you called the 'field' in your forms.py). You will just have to make sure you use the correct field name you used and create the form field by field.
      If there is an easier way around this, Please let me know! I am still quite new to the Dev game.

  • @anthonyfortunes5136
    @anthonyfortunes5136 3 ปีที่แล้ว

    What if u want to use url field instead of image field. is it the same process?

  • @adityarajora7219
    @adityarajora7219 3 ปีที่แล้ว

    uploaded is found to NULL ....please solve this problem.

  • @graceyudha
    @graceyudha 4 ปีที่แล้ว

    can we upload directly from our local machine using ckeditor uploading richtext?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Sorry, don't know what you mean.

  • @Matrix-Glitchs
    @Matrix-Glitchs 3 ปีที่แล้ว

    6:51 April Dog Shit LMAO

  • @evelynhernandez5564
    @evelynhernandez5564 3 ปีที่แล้ว

    Hi Jhon. Thanks for your amazing tutorials. I have no problem when i try to upload the image, but when i try to modify on the 'updated post' page nothing happen. Thanks a lot

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Hm, weird. Typo in the code somewhere

  • @doneeverything5410
    @doneeverything5410 4 ปีที่แล้ว +1

    Make a tutorial on how to upload video like this uploading images ...

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Might do that, but no one uploads video to their own website...you host that stuff on youtube or vimeo or some other service...

    • @deki90to
      @deki90to 4 ปีที่แล้ว

      Just use google, it's very simular

    • @doneeverything5410
      @doneeverything5410 4 ปีที่แล้ว

      @@Codemycom sif if someone wants to make video sharing website ... by the way I loved your content

  • @solkidonakis5407
    @solkidonakis5407 2 ปีที่แล้ว

    can i use this for an api?

  • @ignacioheim8637
    @ignacioheim8637 3 ปีที่แล้ว

    I am trying to use the media object Bootstrap like:
    But it doesnt work. Someone could use it?
    Thanks so mucho for these tutorials!! Greetings from Argentina!

  • @jagadeeshmandala4097
    @jagadeeshmandala4097 3 ปีที่แล้ว

    Can i get github link

  • @erikonomics1400
    @erikonomics1400 3 ปีที่แล้ว

    Hey, great video! I keep getting the following error:
    The 'header_image' attribute has no file associated with it.
    The image is displayed normally on the post where it was uploaded but displays when clicking on other blog posts that do not yet have the image. I made sure to add null, and blank = True in the models.py and if {% post.header_image %} in details.html. Any ideas what else could be causing trouble? Thanks!

    • @waseksamin3216
      @waseksamin3216 3 ปีที่แล้ว

      YOu have to type {{ post.header_image.url }}

  • @silaskanku7377
    @silaskanku7377 2 ปีที่แล้ว

    Hi Codemy
    i have code error : NameError: name 'os' is not defined
    I tried to "import os" in the sesttings.py but its still no working. May you please help.

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      What did you do differently from the video?

    • @silaskanku7377
      @silaskanku7377 2 ปีที่แล้ว

      @@Codemycom Now it's working
      i'm following exactly what you did. However I just had to add "import os" inside settings.py file, then add BASE_DIR = Path(__file__).resolve().parent.parent instead of BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
      I googled it actually

  • @anonone9779
    @anonone9779 3 ปีที่แล้ว

    How to upload multiple files sir

  • @sametdemir3961
    @sametdemir3961 4 ปีที่แล้ว

    will you make comment section? thanks for the video!

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +2

      Eventually yes

  • @benabdallahrahma8245
    @benabdallahrahma8245 3 ปีที่แล้ว

    please i want to save my images in a mongodb database i tried with GridFSStorage but i didn't get any result could you please help me and thank you for your content it's really helpful.

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Sorry, I don't have any videos on Mongo

  • @aaronapm53
    @aaronapm53 2 ปีที่แล้ว +2

    pelao water white

    • @zanz8166
      @zanz8166 2 ปีที่แล้ว

      este kree k uno e loji el caeza e hueo y la ktm

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Ha

  • @maihuire11
    @maihuire11 3 ปีที่แล้ว

    os is not defined.

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      In your settings.py file, type: import os

    • @maihuire11
      @maihuire11 3 ปีที่แล้ว

      @@Codemycom Excellent, I already corrected it. thank you.

  • @josephdoneecagampang3007
    @josephdoneecagampang3007 3 ปีที่แล้ว

    Good day sir, I watched your video over and over again, still my media folder/directory doesn't appear. When I go to the django admin, it shows the image file name, but when I click on it, it says "'...\media\FB_IMG.jpg' does not exist". How can I solve this sir? Please notice me

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      Add this to your settings.py file: import os

    • @dradrigapatrick
      @dradrigapatrick 3 ปีที่แล้ว +1

      I think the new version of django doesnt use os.path() anymore bacuase when i use it, i get the same error,
      use this and see
      MEDIA_URL = '/media/'
      MEDIA_ROOT = BASE_DIR / 'media'
      STATICFILES_DIRS = (
      BASE_DIR / 'static',
      )
      and in url.py (root) use this option
      if settings.DEBUG: # new
      urlpatterns += static(settings.MEDIA_URL,
      document_root=settings.MEDIA_ROOT)
      instead of adding a + infront of the existing urlpatterns . Its same thing but when i used it, i ran into a crsf_token error.
      Hope this helps out.
      Otherwise the best

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      @@dradrigapatrick it doesn't. you need to add this to your settings.py file:
      import os

    • @dradrigapatrick
      @dradrigapatrick 3 ปีที่แล้ว

      Codemy.com Mine works well without import os

  • @solomonkassahun7845
    @solomonkassahun7845 3 ปีที่แล้ว

    Awesome tutorial but when I try it on I got even the URL for the image but it does not display it on the browser. I tried it even for uploading video files but same does not display on browsor. I may need little help here 😃 ...thank you

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Check your code for typos

    • @fajar3972
      @fajar3972 3 ปีที่แล้ว

      have you missed the url text in code ? like {{context.attr.url}}

  • @mathoernsche
    @mathoernsche 3 ปีที่แล้ว

    the doggies

  • @rahulagarwal5694
    @rahulagarwal5694 4 ปีที่แล้ว

    great video
    can you make a video related to tags using Django-taggit

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      I've never used that, sorry

  • @cimihan4816
    @cimihan4816 4 ปีที่แล้ว

    make a video on posting comments on blogs

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      probably will

  • @gouthamgoutham7640
    @gouthamgoutham7640 4 ปีที่แล้ว

    Sir do a video on uploding videos

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Probably won't. You wouldn't ever do that, you'd use a service like vimeo or something to host video.

  • @derekkroeker4582
    @derekkroeker4582 3 ปีที่แล้ว

    Django 3.2 looks different 8:58

    • @derekkroeker4582
      @derekkroeker4582 3 ปีที่แล้ว

      BASE_DIR = Path(__file__).resolve().parent.parent

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      @@derekkroeker4582 just add: import os to your settings.py file

  • @uzbegimuz3836
    @uzbegimuz3836 3 ปีที่แล้ว

    Are they your own dogs

  • @liviumircea6905
    @liviumircea6905 3 ปีที่แล้ว

    media ,static files configuration blah blah real pain in the ass

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      not really, no.