Question

django admin static files are collected to spaces but my project static files aren't.. how can i upload my project static files?

i followed this tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-a-scalable-django-app-with-digitalocean-managed-databases-and-spaces

when i run “collectstatic”, only my admin static files gets uploaded to digitalocean spaces. i cannot find my project assets folder. Only the admin section has got styling. below is my custom storage settings

from storages.backends.s3boto3 import S3Boto3Storage, S3StaticStorage

class MediaStorage(S3Boto3Storage):

    location = 'media'

    file_overwrite = False


class StaticStorage(S3Boto3Storage):
    bucket_name = 'monkeypost-static'

    location = 'static'

    file_overwrite = False

#settings.py

AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME')
AWS_S3_REGION_NAME = 'nyc3'
AWS_S3_ENDPOINT_URL = config('AWS_S3_ENDPOINT_URL')
# AWS_S3_CUSTOM_DOMAIN = config('AWS_S3_CUSTOM_DOMAIN')
AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400',
}
AWS_LOCATION = config('AWS_LOCATION')
AWS_DEFAULT_ACL = 'public-read'
AWS_S3_SIGNATURE_VERSION = 's3v4'

STATICFILES_STORAGE =  'custom_storages.StaticStorage'
DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'

and also when i tried to use this …

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'

i get this error on the server…

SuspiciousOperation("Attempted access to '%s' denied." %
django.core.exceptions.SuspiciousOperation: Attempted access to 'ckeditor/ckeditor/' denied.

someone please help.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer