Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I’m having issues with Django’s static files not being uploaded to Digital Ocean Spaces (S3-compatible storage) in production since I’ve upgraded to Django 5.2 from 4.2. As part of this upgrade I also updated python, boto3 and django-storages.
The collectstatic command appears to run successfully locally, but files are not being updated in the Spaces bucket. Additionally, some static files (particularly CSS) are being served as downloads instead of being rendered in the browser.
django-storages[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django = "==5.2"
pillow = "*"
python-dotenv = "*"
stripe = "*"
mailchimp-marketing = "*"
dotenv = "*"
gunicorn = "*"
psycopg2 = "*"
django-storages = "==1.14.2"
boto3 = "==1.34.69"
weasyprint = "*"
[dev-packages]
[requires]
python_version = "3.12"
# settings.py (production settings)
AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = 'equine-pro'
AWS_S3_ENDPOINT_URL = 'https://ams3.digitaloceanspaces.com'
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400',
'ACL': 'public-read'
}
AWS_DEFAULT_ACL = 'public-read'
AWS_LOCATION = 'static'
AWS_S3_CUSTOM_DOMAIN = 'equine-pro.ams3.cdn.digitaloceanspaces.com'
AWS_S3_REGION_NAME = 'ams3'
AWS_S3_FILE_OVERWRITE = True
AWS_QUERYSTRING_AUTH = False
AWS_S3_VERIFY = True
AWS_S3_SIGNATURE_VERSION = 's3v4'
AWS_S3_ADDRESSING_STYLE = 'virtual'
STATICFILES_STORAGE = 'equineproclinic.storage_backends.StaticStorage'
# storage_backends.py
from storages.backends.s3boto3 import S3Boto3Storage
import logging
logger = logging.getLogger(__name__)
class StaticStorage(S3Boto3Storage):
location = 'static'
default_acl = 'public-read'
def _save(self, name, content):
logger.info(f"Attempting to save {name}")
try:
# Set content type based on file extension
content_type = self._get_content_type(name)
params = {
'ACL': self.default_acl,
'CacheControl': 'max-age=86400',
'ContentType': content_type
}
return super()._save(name, content, extra_args=params)
except Exception as e:
logger.error(f"Error saving {name}: {str(e)}")
raise
Any help or guidance would be greatly appreciated!
collectstatic command runs without errorsSarkariResultht
KFSys
Arne van Hoorn
alexdo
4287c71658bd4ea39bef277d491b1c
4287c71658bd4ea39bef277d491b1c
Demanix
Demanix
devjk1
Jordan
LC Labs Sp. z o.o.
a0cd9be01b14447384f79073fc121f