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

452
Visualizações
Failed to load resource: the server responded with a status of 504 (Gateway Timeout)

I am developing a project using django - python, javascript. When I call a long running process (time-consuming) approx more than 20 minutes from views the process starts successfully. I used loader in ajax to notify user that process is running. After the process completes the loader will stop and change to completed state.

But the issue is every time after 14.59 minutes from process started, the loader stops and status change to completed. But the process running in background is not yet completed. The page crash after that time. After the process complete I bind the result under a tag in web page. In that tag the error 504 (Gateway Timeout) arise. In web console log Failed to load resource: the server responded with a status of 504 (Gateway Timeout), the above error prints. If anyone knows please help me to fix this.

Is the django is closing the connection after that time ? If so is there possible to mention timeout in django settings (settings.py). I tried giving timeout in ajax call but the same issue returns. My doubt is on django development server. Is there timeout in django development server. But when I search for this issue I found, in nginx server the same type of issue arise. Is django depend on nginx or using it ?

I tried to provide all information regarding my issue if any further clarifications, please let me know.

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

0

The server always closes its connection after a particular amount of time, which can be modified by changing its configuration, but that would not be a good approach. I would suggest you to try to reduce time taken by the script by:

  • Optimizing Your code.
  • By caching data which is to be used often
  • using backend services which will process your data and store them in temporary storage such as memcache or redis which can be quickly accessed.

Also you should handle the timeout of the ajax call:

$.ajax({
    ...
    timeout: 1000,
    error: function(jqXHR, textStatus, errorThrown) {
        if(textStatus==="timeout") {
           //do something on timeout / show appropriate message.
        } 
    }
});​

References for tweaking performance and optimizing coding techniques thus reducing time: https://docs.djangoproject.com/en/1.10/topics/db/optimization/ https://docs.djangoproject.com/en/1.10/topics/performance/ https://realpython.com/blog/python/caching-in-django-with-redis/

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