2 years ago
Hello all, I am having an issue where images are not loading in my Django application in production (they work on local server). I think this might be something to do with my Media settings.
I have a model, called Profile, that has the field:
image = models.ImageField(default='default.jpg', upload_to='profile_pics')
My folder structure is currently:
>project-name
->blog
->project-name
->media
--->profile_pics
------>image.jpg
->staticfiles
------>admin
------>blog
->users
My settings.py includes:
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
The static images seems to be loading
But the media images are not
4 Replies
2 years ago
Good question. Did you solve this problem?
2 years ago
I have the same problem did u find any solutions ?
2 years ago
I also have this problem 😞
2 years ago
U must use S3 or Cloudinary