I am working on a website in django framework .There is table in the DB as django_sessions which is a default table in the DB.
The session created is for 15 days once a user log in . How can I change it to more no of days?
Do i need to tweek the core files for that ,Because I strictly follow the policy not to touch the core files ,,for any sort of updates in the future .

It is driven by a setting called SESSION_COOKIE_AGE
Documentation here
If you want to set it to 18 days , in your settings file,
SESSION_COOKIE_AGE = 18 * 24 * 60 * 60
Default SESSION_COOKIE_AGE is 1209600 that is 2 week in seconds.
Take a look at the session middleware and its settings here is the link: https://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions
and also visit https://docs.djangoproject.com/en/1.5/topics/http/sessions/#session-cookie-age link and it will provide all the session information that you required.
As said my @karthikr you can set SESSION_COOKIE_AGE = 18 * 24 * 60 * 60
And if there is any case like a website that requires us to log a user out after N minutes of inactivity. At this time you can use the same settings
SESSION_COOKIE_AGE
Default: 1209600 (2 weeks, in seconds)
The age of session cookies, in seconds.
SESSION_SAVE_EVERY_REQUEST
Default: False
Whether to save the session data on every request. If this setting is False (default), then the session data will only be saved if it has been modified. In short, if any of its dictionary values have been assigned or deleted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With