my friends, this is my first question here. So, I follow the Django documentation and some questions here, but the problem keep happening. I did what was said on other similar questions, like this one, for examaple: But the problem persists.
So, my model looks like this:
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete = models.CASCADE, primary_key=True)
picture = models.ImageField(blank = True, null = True, upload_to = user_directory_path)
whatsapp = models.PositiveIntegerField(blank = True, null = True)
My settings looks like this:
MEDIA_ROOT = f"{BASE_DIR}/media"
MEDIA_URL = '/media/'
I added
+ static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
to the end of my urls.py file.
The folder and images are being created on my file system when I add them via the admin, but when I click to see them over there I recieve a 404.
I am making a mobile app and serving my data using Django Rest Framework, the images are the only thing giving me a headache right now.