2

Where do you set the path to which the command collectstatic uploads files?

I thought it was STATIC_ROOT. Mine is set as follows in settings.py

STATIC_ROOT = 'http://%s.s3.amazonaws.com/static/' % AWS_STORAGE_BUCKET_NAME

However, it is uploading my files to http://%s.s3.amazonaws.com/ and dumping it in the root rather than the static folder.

What am I doing wrong?

user1328021
  • 9,110
  • 14
  • 47
  • 78

1 Answers1

0

STATIC_ROOT is used by django.contrib.staticfiles.storage.StaticFilesStorage to identify a local filesystem path to write the static files to. That isn't what you're trying to do.

Instead, you want the how-to for Serving static files from a cloud service or CDN. As that guide suggests, you'll need a storage backend from some project like django-storages.

Jamey Sharp
  • 8,363
  • 2
  • 29
  • 42
  • Thanks I am using django-storages. How do I set its upload path to point to my media directory? – user1328021 Nov 05 '12 at 03:36
  • The django-storages documentation for the [S3 backend](http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html) should answer for everything you need, I think. Depending on your needs you might not want to change `DEFAULT_FILE_STORAGE`, but it documents `STATICFILES_STORAGE` too. – Jamey Sharp Nov 05 '12 at 03:49
  • I don't think `django-storages` supports custom subdirectories. Look at the `django-s3-folder-storage` app – Amandasaurus Apr 03 '14 at 14:41