Volume Path and Django Media Root

I have a new app that involves uploading images. I have tried all sorts of different combinations in fly.toml and my settings.py, but nothing has worked yet. Let’s pretend my app is named ‘fubar’. Here is what I am doing right now before my flyctl deploy:

# fly.toml

  source = "fubar_media"
  destination = "/data"
# settings.py

MEDIA_ROOT = BASE_DIR / 'data/media'
MEDIA_URL = '/media/'

Let me ask a few questions:

  1. There seem to be discrepancies between V1 and V2 with regard to the path. I am not altogether sure whether the [mounts] destination should be "/data", "/app/data", or "/fubar/data".

  2. Perhaps my MEDIA_ROOT should simply be '/data/media' and should exclude the BASE_DIR?

I used these values for my first attempt:

# fly.toml

  source = "fubar_media"
  destination = "/media"
# settings.py

MEDIA_URL = '/media/'

Thank you for any help you can provide!

Hey @zip

Can you have a look at this? Add Volume Storage · Fly Docs

documentation suggests something like this

# fly.toml

where myapp_data is volume name
and /data is location where you want to mount the volume

1 Like

Hi @darkcheftar007,

Update: Thanks - Yes, I been setting the destination to the root, "/data", and my uploads are working and they persist. At this point my issue is Django itself, which is refusing to serve local media files. If I find a solution I will post it here.

Check this,

Hope it helps

The way I have been trying to do this is with Whitenoise, but it’s not working:

# settings.py



Whitenoise is correctly serving my css, but not the media images uploaded by an admin.

Has anyone figured out how to do this? Sorry to resurrect a dead thread, but I am currently stuck on the same thing.

Hey @Opuffer,
Welcome to community.
Have you figured it out?