Django with Volume Support

2 years ago

Description: Use Railway Volumes with Django

Category: Starters

URL: https://railway.app/template/AWUIv6

3 Replies

matt-a
PRO

2 years ago

nice one, Vin!


noamtamir
HOBBY

a year ago

Thanks this saved me!
The magic lines that helped me:

mysite/settings.py

MEDIA_ROOT = os.environ["RAILWAY_VOLUME_MOUNT_PATH"]

mysite/urls.py

urlpatterns += [ re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT})]


a year ago

Glad it worked out for ya!