I'm in process launching a Django (1.11.x) project on AWS (ElasticBeanstalk, S3, RDS). With boto3 and django-storages App I managed that my static files push to S3, straight into the bucket. However the S3 bucket has some other files and directories unrelated to static. For that reason I would like to create a Folder within the S3 bucket called static and push all the static files into this specifically designated directory.
My settings.py looks like this:
[...]
# Static files (CSS, JavaScript, Images)
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
AWS_ACCESS_KEY_ID = AWS_S3_MyKEY
AWS_SECRET_ACCESS_KEY = AWS_S3_MySECRET
AWS_STORAGE_BUCKET_NAME = 'elasticbeanstalk-us-west-2-1xxxxxxxxxxx1'
AWS_S3_CUSTOM_DOMAIN = '%s.s3-us-west-2.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_QUERYSTRING_AUTH = False
# general static / media settings
STATIC_URL = '/static/'
STATIC_ROOT = 'staticfiles'
MEDIA_URL = '%smedia/' % STATIC_URL
MEDIA_ROOT = '/static/media/'
ADMIN_MEDIA_PREFIX = '%sadmin' % STATIC_URL
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
# ...
]
[...]
I have some experience with Django, but this is my first project involving AWS and boto. Any help would be appreciated. Thank you in advance.