2 years ago
Hello! I added a Volume to my Django project on Railway for persistent storage of PDF-Generated files. I set the mount path to /media. From what I read, there will be a media folder in the base directory (or maybe I need to create one if it does not exist) where the data will be persisted. However when I deploy changes all the files are lost. When I try to access a file using os.path.join('media', 'hello.pdf') I get a file does not exist error. I don't know if I am missing something.
0 Replies
2 years ago
your paths are incorrect, please give the guide a read
Thank you very much. After reading the guid carefully, I realized you were right about paths being incorrect. Indeed, I thought the media directory would be created inside my Django project directory, but it was one level up my directory, so I had to use the ../media relative path to access the volume storage directory. I tried to deploy some changes and the files are still accessible. Thank you
2 years ago
you can use the media
path like you where, but instead set the mount to /app/media
this is what i had hoped you would take away from the docs page
2 years ago
awsome