Hello everyone,
I just deployed my django app and everything looks fine, except:
I have some files in my media directory. These are static files and never change (for some reasons, I couldn’t put them in my static folder). These files are also on my github repo and must be uploaded
with the project deploy. However, when my app tries to get access to these files, I get the following error:
FileNotFoundError
Exception Value:
[Errno 2] No such file or directory: ‘\opt\render\project\src\media\Gravity Database’
The code that is causing this error is:
dataBase_dir = os.path.join(MEDIA_ROOT, “Gravity Database”).replace(‘/’, ‘\’)
files = os.listdir(dataBase_dir)
by the way, in my settings.py:
MEDIA_ROOT = os.path.join(BASE_DIR, ‘media/’)
MEDIA_URL = ‘/media/’
I know one option for dealing with such files is to use Render Disks, however, I would like to figure out the issue with my current approach. My media folder is on my github account and I should be able to have access to them after each deploy.