Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
Configuring Django/Wagtail media to use S3

I'm using the following guide:

https://www.caktusgroup.com/blog/2014/11/10/Using-Amazon-S3-to-store-your-Django-sites-static-and-media-files/

At the section that instructs you on how to "Configuring Django media to use S3". I'm using this for Wagtail.

I'm unclear on where to put the "custom_storages.py" settings. Everywhere I'm putting it doesn't seem to work. I reverted back to Whitenoise for now.

Thanks!

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can put custom_storages.py anywhere on your Python path. Django will try to find the class using the value of the STATICFILES_STORAGE setting, which in the example is 'custom_storages.StaticStorage'. So Django will, in effect "import custom_storages" and use "custom_storages.StaticStorage" as the storage class. Just make sure you can "import custom_storages" and it should work.

about 4 years ago · Santiago Trujillo Relatório

0

You need to set the STATICFILES_STORAGE setting

STATICFILES_STORAGE = 'path/to/custom_storages.StaticStorage'

If you are using wagtail (which I assume you do since you are tagging this question with it), you can place it in the default home/ directory and refer to it like so: 'home/custom_storages.StaticStorage'

The content of custom_storages.py are stated in the guide you are following:

# custom_storages.py
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage

class StaticStorage(S3BotoStorage):
    location = settings.STATICFILES_LOCATION

Edit: I have a GitHub repo (also a wagtail project) in which I am using this code, but only for my media files. You can check it here.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda