How to connect Django media storage to Dokku persistence storage?

Solution

I wanted to see the path to Django's media folder. I put print(MEDIA_ROOT) in base.py to print the path during deployment. It was /app/my_app_dir/media. I realized that /app existed in Dokku documentation, but I always thought that it was a place holder like path/to/app. No, it was the path.

Dokku mount example

dokku storage:mount app-name /var/lib/dokku/data/storage/node-js-app:/app/storage

I fixed my mount command:

dokku storage:mount my_app/var/lib/dokku/data/storage/my_app:/app/my_app_dir/media

and it finally worked!