Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you configure S3BotoStorage or collectstatic to upload to an s3 bucket subdirectory

Is there a way to configure django's collectstatic command to upload to a subdirectory in an s3 bucket, rather than just the top level directory?

Thanks

like image 937
Ash Avatar asked Mar 07 '12 04:03

Ash


1 Answers

If you're using the S3BotoStorage engine from django-storages then there's a settings variable called AWS_LOCATION which will set the key prefix (equivalent to subdirectory) for the S3 bucket you specify in AWS_STORAGE_BUCKET_NAME.

Note that I haven't used this with collectstatic, but I can't see how it wouldn't work given the separation between it and the storage engines.

like image 114
James Aylett Avatar answered Jan 06 '23 15:01

James Aylett