DEV Community

Discussion on: How to build a Django web app from scratch (tutorial)[2024 revised]

 
vladyslavnua profile image
vladyslav nykoliuk • Edited

Hi! So sorry for the delay in reply. I just checked your website it looks like you fixed it and it looks great! For anyone seeing this in future reference - a few possible scenarios:

  1. A static/media root directory error

Solution: Check how you're setting the STATIC_ROOT and MEDIA_ROOT

  1. Whitenoise wasn't properly installed, or saved to requirements

Solution: pip install whitenoise && pip freeze > requirements.txt

To answer your question about external images, the only way I know of referencing an external image by url would be to add another optional field and request that url for the image. A quick example can be seen over on Stack Overflow.

P.S. There seems to be a Markdown glitch for my comment where it doesn't change the second answer to number 2. Goes to show edge cases always exist :) πŸ˜‚

Thread Thread
 
codebyline profile image
Yumei Leventhal • Edited

Thanks for looking into it! I finally figured it out this morning. Just like you said, the issue was related to how the static and media directories were set up. Whitenoise was set up exactly as directed (and works seamlessly). What I ended up doing was deleting all the images from all the static and media folders, modified the path in settings. The app works, though I don't know why. I posted on Stackoverflow hoping to get some explanation, as I've never understood completely how to set up static files aside from copy and paste. So this is my chance to get it sorted it out.

Thread Thread
 
vladyslavnua profile image
vladyslav nykoliuk

ahh gotcha. Yup, I remember I actually tried to answer it on there too :)