Question

how to store django media files to spaces?

Posted March 13, 2020 86 views
Block Storage

MEDIAURL =’/media/’
MEDIA
ROOT=os.path.join(BASE_DIR,‘media’)

how to link to my spaces so that files will be uploaded to spaces not the server.

staticfiles are working as stored on the spaces. but i dont know how to upload media files to storages.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

how to link to my spaces so that files will be uploaded to spaces not the server.

If I understand you correctly, you want to upload the files programmatically to Spaces instead of the Droplet that you are using. You can use the Digital Ocean API to perform these actions, here is the reference API to upload an object (using HTTP PUT request). API exposes other functions that can be used to perform other options (delete, query, etc.).

Check this how-to guide about the Spaces API to learn about what is possible with Spaces.

Submit an Answer