Cursor ai called it a "strange problem", so we're back to the original home of solutions.
I upgraded django from 2.2 to 5.2, and upgraded my storages, tinymce,.. etc modules along with it.
i added a new app after the upgrade, and everything worked well in development. The issue is, when i run collectstatic in production, the static and media files that have already been synced from previous deployments remain available, but some of the static and media subfolders/files from recent upgrades do not get uploaded - even as they are all have the same static and media root directory. How is it that django-storages can "pick and choose" the folders to create within an identified static or media directory?
i'm not sure what other code to include to explain this further, but if anyone needs to see something else, let me know and i'll add code snippets. Thanks.
my settings
from configparser import RawConfigParser
from .base import *
DEBUG = False
ALLOWED_HOSTS = ['www.mywebsite.com']
CSRF_COOKIE_SECURE = True
SECURE_SSL_REDIRECT = True
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000 # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
config = RawConfigParser()
config.read('/dir/ect/ory/file')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': config.get('section', 'DB_NAME'),
'USER': config.get('section', 'DB_USER'),
'PASSWORD': config.get('section', 'DB_PASS'),
'HOST': 'localhost',
'PORT': '5432',
}
}
# AWS S3 Configuration
AWS_ACCESS_KEY_ID = config.get('section','KEY_ID')
AWS_SECRET_ACCESS_KEY = config.get('section', 'SCRT_KEY')
AWS_STORAGE_BUCKET_NAME = config.get('section', 'BUCKET_NAME')
AWS_S3_REGION_NAME = 'us-east-1'
AWS_S3_FILE_OVERWRITE = False
AWS_S3_VERIFY = True
AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com'
# For static files (public)
AWS_QUERYSTRING_AUTH = False
# Static files configuration
STORAGES = {
'staticfiles': {
'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage',
'OPTIONS': {
'location': 'static', # or your desired S3 folder
},
},
'default': {
'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage',
'OPTIONS': {
'location': 'media',
},
},
}
STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/static/'
# Media files configuration
MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/media/'
# Cache control
AWS_S3_OBJECT_PARAMETERS = {
'CacheControl': 'max-age=86400',
}