On the how-to for deploying Scalable Django app., there are instructions for the settings, adding.
AWS_S3_CUSTOM_DOMAIN = 'spaces_edge_endpoint_URL'
What is not clear to me, does this URL allow writing to the also? Or do I need to somehow configure separate read and write URLs?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
When integrating Django with DigitalOcean Spaces using the CDN, the
AWS_S3_CUSTOM_DOMAIN
typically refers to the CDN endpoint of the Space for reading (i.e., serving static/media files). The purpose of using the CDN endpoint is to distribute the content globally to reduce latency for users fetching those assets.For writing (i.e., uploading files to the Space), Django will use a different endpoint which will be the DigitalOcean Space’s endpoint (not the CDN endpoint). This distinction is managed internally by the libraries you use (like
django-storages
with the S3 backend).To clarify:
Reading Files (Serving): Your Django app will serve static and media files using the CDN endpoint (e.g.,
your-space-name.nyc3.cdn.digitaloceanspaces.com
). This is whereAWS_S3_CUSTOM_DOMAIN
comes into play when you want to serve these assets using the CDN.Writing Files (Uploading): When your Django app needs to upload a file to the Space, it will use the endpoint associated with your Space directly (e.g.,
nyc3.digitaloceanspaces.com
). This is typically managed through theAWS_STORAGE_BUCKET_NAME
andAWS_S3_REGION_NAME
settings in conjunction with the library.To answer your concern directly: No, you don’t need to configure separate read and write URLs in your Django settings when using the typical
django-storages
setup for DigitalOcean Spaces. TheAWS_S3_CUSTOM_DOMAIN
is primarily for reading (serving) files through the CDN, while writing (uploading) is managed internally by the library.Best,
Bobby