python collectstatic does not copy all my static files

I currently have DigitalOcean spaces setup & using it with django via ‘django-storages’.

Currently I am running into a problem where the collectstatic command will not collect all my static files. - static files

# Static files (CSS, JavaScript, Images)

    os.path.join(BASE_DIR, 'static'),

AWS_ACCESS_KEY_ID = 'my_access_key' 
AWS_SECRET_ACCESS_KEY = 'my_secret_key'

    'CacheControl': 'max-age=86400',

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

# Use AWS_S3_ENDPOINT_URL here if you haven't enabled the CDN and got a custom domain. 
STATIC_URL = '{}/{}/'.format(AWS_S3_ENDPOINT_URL, 'static')
STATIC_ROOT = '/static/'

MEDIA_URL = '{}/{}/'.format(AWS_S3_ENDPOINT_URL, 'media')
MEDIA_ROOT = '/media/'

TEMP = "{}/{}".format(MEDIA_ROOT, 'temp')

My Static Files:

 - accounts
 - core
 - images
 - lrdc
 - terms
 - jquery.js

Digital Ocean Spaces:

 - images
 - images
 - admin
 - jquery.js

Any help will be greatly appreciated! Thank you :D

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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
June 6, 2023


It seems like you’re experiencing issues with the collectstatic command not gathering all of your static files in your Django project. Let’s break down the potential issues and solutions:

  1. Verify that collectstatic is working properly: First, run the collectstatic command manually in your local environment and see if it is collecting all the static files. If it’s not, the issue might not be related to DigitalOcean spaces, but with how your static files are set up.

  2. Check your module: You’re using custom_storages.StaticStorage and custom_storages.MediaStorage as your STATICFILES_STORAGE and DEFAULT_FILE_STORAGE respectively. It’s possible that these classes might be incorrectly defined, causing issues. It would be helpful to review those classes.

  3. Confirm your static files location: Make sure all static files are properly placed under the directories specified in the STATICFILES_DIRS setting. From your file structure, it seems like you’ve got your static files correctly placed. But it might be worth double checking if all files are under the ‘static’ directory in your BASE_DIR.

  4. STATIC_ROOT Setting: STATIC_ROOT is the absolute path to the directory where collectstatic will collect static files for deployment. In your configuration, it seems like you’re setting it to ‘/static/’. Please ensure that this directory is correctly set and Django has appropriate permissions to access and write into this directory.

  5. STATICFILES_FINDERS Setting: Django uses the STATICFILES_FINDERS setting to locate static files in addition to those it finds in STATICFILES_DIRS. By default, it includes FileSystemFinder (for files in STATICFILES_DIRS) and AppDirectoriesFinder (for files in the ‘static’ subdirectory of each app). If you haven’t changed this setting, Django should automatically find static files in your apps. However, if you’ve changed it, that might be causing your problem.

  6. Bucket Policy: Please ensure that your bucket policy in DigitalOcean Spaces is set correctly. You should have read and write permissions for the provided AWS key and secret.

Hopefully, one of these points will help you identify the issue. If none of these work, please provide any error messages you’re getting, or any other unusual behavior you’re seeing when you run collectstatic.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.