Menu Close

How to expire Python Django session in 5 minutes?

Sometimes, we want to expire Python Django session in 5 minutes.

In this article, we’ll look at how to expire Python Django session in 5 minutes.

How to expire Python Django session in 5 minutes?

To expire Python Django session in 5 minutes, we can set the SESSION_COOKIE_AGE setting in settings.py.

For instance, we write

SESSION_COOKIE_AGE = 5*60

in settings.py to set sessions to expire in 5 minutes.

Conclusion

To expire Python Django session in 5 minutes, we can set the SESSION_COOKIE_AGE setting in settings.py.

Posted in Python, Python Answers