Django media with volume
Hi,
Im trying to link railway volume with my django deployment.
Does anyone able to make it work? Point me out if I'm not using the correct setup. Thanks
11 Replies
Project ID:
e4929780-2d35-4751-a60d-5216ec1f7378
e4929780-2d35-4751-a60d-5216ec1f7378
1. mount to
/app/media
2. do not define any variables for the volume yourself, please remove them
3. have a look at this template https://railway.app/template/AWUIv6Done 1 and 2. And change my setting.py according to 3 for media_root . But no luck so far. Not sure where i'm missing
After i remove compress in model save function. i can upload just fine. Not sure why though....
bug in the compressor code?
Nvm that one is separate issue. I saw the template is using serve view and it is not recommended for for production. https://docs.djangoproject.com/en/4.2/ref/views/.
Any other way i can serve the media easily? Probably need to expose in nginx the media folder or smething like that. I'm really bad at this deployment/devops
thats correct, it is not recommended for production, but (and i really mean no offense) if you have to ask how to do it properly, the serve view is likely more then sufficent for you, but you do have the right idea, you would need nginx or caddy to serve the files from the media folder and then have it proxy all other traffic to django
Yes, the way the template is setup currently, is not meant for production use. Small scale production it is fine, but serving 10’s of thousands of users, definitely not. Maybe even thousands. The template is just a guide on getting things working for testing. I plan on setting up another template soon for properly serving in production environments
Thanks @Brody and @Vin.