title | description | tags | |||
---|---|---|---|---|---|
Django Volume Support |
A Django Template with Volume Support for Railway |
|
This example template starts a Django server utilizing volume support on Railway for storing and serving assets.
- Django
- Railway Volumes
- Python 3
- Clone locally and install packages with pip using
pip install -r requirements.txt
- Run locally using
python manage.py migrate && python manage.py collectstatic --noinput && gunicorn mysite.wsgi
If you get the following error No such file or directory: '/app/media/directory/...'
make sure your directory exists since your folder structure has to be build from scratch for production purpose on the persistent storage.
You can use something like this:
new_directory = os.path.join(settings.MEDIA_ROOT, 'directory')
if not os.path.exists(new_directory):
os.makedirs(new_directory)