Python Django Tutorial: Full-Featured Web App Part 8 - User Profile and Picture
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about displaying or saving uploaded images and building user profile pages in Django.
Recommended by 2 people across 2 different months, 2019 to 2020.
What it is
Part 8 of Corey Schafer's Django web app series, a 35-minute screen-recorded tutorial. It builds a Profile model linked one-to-one to Django's User model, stores profile pictures with ImageField, configures MEDIA_ROOT and MEDIA_URL, serves uploaded files through URL patterns, and uses a signal receiver to create profiles on registration.
What people said
Recommends Greg · 2019-07 · Stack Overflow · on “Display images in Django”
It looks like you may be trying to follow a video tutorial series by Corey Schaefer. If so, my suggestion won't help, but if not, Corey Schaefer has a video that covers exactly what you're trying to do at [this video] . You have to set quite a number of settings and override some defaults. The django documentation has two ways of doing it, one for development on localhost and another for production: [LINK]
Recommends Mayur Satav · 2020-07 · Stack Overflow · on “How to save uploaded image to Model in Django? All fields except the image field is getting saved to Model”
this is the snippet from one of my project i hope it will also work for you or follow this amazing youtube video [this video] models.py class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(default='default.jpg', upload_to='profile_pics')
Cites Ali Akhtari · 2019-06 · Stack Overflow · on “I'm trying to implement blog app with django.In homepage of app there will be list of posts alongside i need show there profile picture?”
duplicate question I think, check the links below : Add image/avatar field to users in django [LINK] Django user profile [LINK] Extending the User model with custom fields in Django [LINK] Django user profile tutorial_ youtube [this video] Django user profile tutorial _ youtube [this video]
Cites japheth · 2019-06 · Stack Overflow · on “Best way to load static images in Django from root directory”
I resorted to using my_app/static/my_app for the images, and it worked. Was following another tutorial [this video] but seems they didn't factor in the trouble with navigating to other pages. But with the above directory, the images are loading fine.