'python Manage.py Collectstatic' Is Still Collecting Static To C Drive Instead Of S3 Bucket, Am I Missing Something?
I am trying to use s3 bucket with django (I have done this like twice before) but this time, after installing boto3 and django-storages and assigning correct values to necessary va
Solution 1:
I tend to have define my own subclass of S3Boto3Storage and use that
# ./storage_backends.py - lives in the same dir as the config file.from storages.backends.s3boto3 import S3Boto3Storage
from django.conf import settings
classStaticRootS3BotoStorage(S3Boto3Storage):
location = settings.STATIC_DIRECTORY
Then
# config.py
STATIC_DIRECTORY = BASE_DIR + "/build/static"# You will need to change this to your path
STATICFILES_STORAGE = 'config.settings.storage_backends.StaticRootS3BotoStorage'# you also need to change this to the path to the file we created above.
STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, STATIC_DIRECTORY)
Now you can override methods for debugging and see where the problem might be.
Post a Comment for "'python Manage.py Collectstatic' Is Still Collecting Static To C Drive Instead Of S3 Bucket, Am I Missing Something?"