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

166
Visualizações
Django Media File deployment - change in file location

I am having a web server running in Digitalocean. We are in a situation where we need to upload our clients' images (media files). Now, as far as the understating goes, in the following case:

class Car(models.Model):
    ...
    photo = models.ImageField(storage=fs)

The photo field will store the url of the file, right?

Now we might move to amazon (with S3 as the storage system) in near future. Will the model field value change?

How do you, then, suggest us in taking care of the change (as we will have two servers then, one EC2 for django & S3 for media & static files)?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can upload your static and media files to S3 during deployment after collectstatic. In case of multiple servers, you only need to run collectstatic in one server, then you will be able to reach same content from S3 for multiple servers.

If you take a look https://www.caktusgroup.com/blog/2014/11/10/Using-Amazon-S3-to-store-your-Django-sites-static-and-media-files/ there is a detailed guide on how to store files on S3.

over 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