Question

My django_session table was growing very large and it seems to be due to a pingdom bot that I set-up hitting my login page. I tried creating a brand new django 1.4 app and the behaviour is replicated on any page that uses the django.contrib.auth.views.login page, including the default admin login page.

This surely can't be the desired behaviour. Is it a bug? Is there a fix?

(I have redirected the pingdom bot to another page that doesn't cause a new session to be created but I'd like to solve the django issue itself too).

I have seen the question here Huge Django Session table, normal behaviour or bug? and it doesn't seem to be the same issue

Was it helpful?

Solution

After a little bit of searching I found that this is done by the login view (line 55) in the set_test_cookie() method.

In the latest version of Django (git main) it has been removed however: https://github.com/django/django/commit/9d2c0a0ae6ce931699daa87735d5b8b2afaa20f9#django/contrib/auth/views.py

For the time being I would simply recommend you to use a modified version of the login page which doesn't use the set_test_cookie() method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top