Oh sure!
1) if you want this to be a URL-based lifecycle session:
for each view add your configuration line:
app.permanent_session_lifetime = timedelta(seconds=int)
or
app.config['PERMANENT_SESSION_LIFETIME'] = <intended_value_in_seconds>
2) if it is intended for each user:
I recommend creating groups and assigning a specific configuration to each group so that you can simply invoke the configuration when necessary.
def group_session(self, group): if group_session == 'visitors': return app.config['PERMANENT_SESSION_LIFETIME'] == <intended_value_in_seconds> if group_session == 'admin': return app.config['PERMANENT_SESSION_LIFETIME'] == <intended_value_in_seconds> return app.config['PERMANENT_SESSION_LIFETIME']
3), if you prefer the lifetime of a user session, then:
if user == <chosen_name>: app.config['PERMANENT_SESSION_LIFETIME'] == <intended_value_in_seconds>
Hope this helps!
source share