Django with Volume Support

a year ago

Description: Use Railway Volumes with Django

Category: Starters

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

3 Replies

matt-aPRO

a year ago

nice one, Vin!


noamtamirHOBBY

8 months 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})]


8 months ago

Glad it worked out for ya!