I uploaded my web app online. It contains a section that sends an audio file as input. Previously locally I used FileSystemStorage to store files in the “media/my_audio” path, but now that I’ve uploaded it to Google Cloud Platform I can’t do that anymore. I have already configured everything, but I think there is some problem in my code.
This is the code I tried to use:
“settings.py”
`PROJECT_ROOT = os.path.join(os.path.dirname(os.path.abspath(file)), os.pardir)
DEFAULT_FILE_STORAGE = ‘storages.backends.gcloud.GoogleCloudStorage’
STATICFILES_STORAGE = ‘storages.backends.gcloud.GoogleCloudStorage’
GS_PROJECT_ID = ‘my_id’
GS_STATIC_BUCKET_NAME = ‘my_STATIC_BUCKET_NAME’
GS_MEDIA_BUCKET_NAME = ‘my_MEDIA_BUCKET_NAME’ # same as STATIC BUCKET if using single bucket both for static and media
STATIC_URL = ‘https://storage.googleapis.com/{}/’.format(GS_STATIC_BUCKET_NAME)
STATIC_ROOT = “static/”
MEDIA_URL = ‘https://storage.googleapis.com/{}/’.format(GS_MEDIA_BUCKET_NAME)
MEDIA_ROOT = “media/”
UPLOAD_ROOT = ‘media/uploads/’
DOWNLOAD_ROOT = os.path.join(PROJECT_ROOT, “static/media/downloads”)
DOWNLOAD_URL = STATIC_URL + “media/downloads”`