From 365f360f0e79c761bd6fb9c26009b4f782f752eb Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 25 Jul 2024 16:53:28 -0500 Subject: Initialise sessions for the application. --- uploader/__init__.py | 3 +++ uploader/default_settings.py | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'uploader') diff --git a/uploader/__init__.py b/uploader/__init__.py index feffcae..a3b36e7 100644 --- a/uploader/__init__.py +++ b/uploader/__init__.py @@ -4,6 +4,7 @@ import logging from pathlib import Path from flask import Flask, request +from flask_session import Session from .entry import entrybp from .upload import upload @@ -41,6 +42,8 @@ def create_app(): # setup jinja2 symbols app.add_template_global(lambda : request.url, name="request_url") + Session(app) + # setup blueprints app.register_blueprint(base, url_prefix="/") app.register_blueprint(entrybp, url_prefix="/") diff --git a/uploader/default_settings.py b/uploader/default_settings.py index 7a9da0f..3add7ef 100644 --- a/uploader/default_settings.py +++ b/uploader/default_settings.py @@ -12,3 +12,7 @@ REDIS_URL = "redis://" JOBS_TTL_SECONDS = 1209600 # 14 days GNQC_REDIS_PREFIX="GNQC" SQL_URI = "" + +SESSION_TYPE = "redis" +SESSION_PERMANENT = True +SESSION_USE_SIGNER = True -- cgit v1.2.3