Media images not loading in Django Railway project

ekim-67
HOBBY

a year 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', uploadto='profilepics')

My folder structure is currently:

project-name
->blog
->project-name
->media
--->profile_pics
------>image.jpg
->staticfiles
------>admin
------>blog
->users

My settings.py includes:

STATICROOT = BASEDIR / 'staticfiles'
STATICURL = '/static/' MEDIAROOT = os.path.join(BASEDIR, 'media') MEDIAURL = '/media/'

The static images seems to be loading
But the media images are not

4 Replies

xor0x
HOBBY

a year ago

Good question. Did you solve this problem?


yacinelaribi
TRIAL

a year ago

I have the same problem did u find any solutions ?


tierraskyllc
HOBBY

9 months ago

I also have this problem


xor0x
HOBBY

9 months ago

U must use S3 or Cloudinary