Media images not loading in Django Railway project
ekim-67
HOBBYOP

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

xor0x
HOBBY

2 years ago

Good question. Did you solve this problem?


yacinelaribi
TRIAL

2 years ago

I have the same problem did u find any solutions ?


tierraskyllc
HOBBY

2 years ago

I also have this problem 😞


xor0x
HOBBY

2 years ago

U must use S3 or Cloudinary


Welcome!

Sign in to your Railway account to join the conversation.

Loading...