Worker Timeout (Django App Refreshing Every 30 Seconds)

So I deployed my app a while ago and started noticing a weird behaviour where the web page would refresh every minute or so.

Looking at the logs, I saw the below:

This is what my fly.toml file looks like:

app = "myapp"
primary_region = "waw"
console_command = "/code/manage.py shell"

[build]

[deploy]
  release_command = "python manage.py migrate"

[env]
  PORT = "8000"

[http_service]
  internal_port = 8000
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0
  processes = ["app"]



[[statics]]
  guest_path = "/code/static"
  url_prefix = "/static/"

I have not coded any workers/celery or anything in my app, and because I am a newby, I really can’t figure out what to try out.
Based on what I read, this could be related to gunicorn, but I am not sure how to troubleshoot because I cannot find anything about it in the forums or in the help. All points out at solutions where people actually have implemented workers in their code, which I haven’t.

1 Like

I solved this.

I enabled Docker logs to understand what the gunicorn workers were doing. I did this by modifying the docker file like so:

CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "--access-logfile", "-", "--error-logfile", "-", "my_django_project_name.wsgi"]

Then I could see the culprit. It was a very handy extension I have been using for development called django-browser-reload which refreshes the browser to show the most recent changes.

I removed the app from installed apps and removed the line from the middleware.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.