Quart_Sessions Redis deletes keys and create backups instead

27 Views Asked by At

I am currently using Quart in conjunction with Quart_Sessions as session management for login etc.

I have the problem that sometimes all keys in the Redis database are simply deleted and 4 backups ("backup1", "backup2", "backup3", "backup4") are created instead. This always causes all sessions to expire.

**The Redis database is created as a stack via Portainer: **

version: '3'

services:
  redis:
    image: redis
    restart: always
    ports:
      - "6379:6379"
    environment:
      - REDIS_PASSWORD=[MyPassword]
    volumes:
      - redis_data:/data
      - ./redis.conf:/etc/redis/redis.conf

volumes:
  redis_data:
    driver: local

The connection with Quart is as follows:

from quart import Quart, jsonify, request, send_from_directory, render_template, redirect, url_for, session, g, make_response
from quart_session import Session

app = Quart(__name__, template_folder='static')

app.secret_key = '[MyPassword]'

redis = None

app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.config['JWT_SECRET_KEY'] = '[MyPassword]' 
app.config['SESSION_TYPE'] = 'redis'
app.config['SESSION_URI'] = 'redis://default:[MyPassword]@[URL]:6379'
app.config['SESSION_USE_SIGNER'] = False
app.config['SESSION_PROTECTION'] = True
app.config['SESSION_COOKIE_DOMAIN'] = ".[DOMAIN]"
app.config['SESSION_COOKIE_NAME'] = 'User session'
app.config['SESSION_COOKIE_MAX_AGE'] = 3600
app.config['SESSION_REVERSE_PROXY'] = True

Session().init_app(app)

Can someone tell me why this is the case?

  • Reinstallation of the Redis database
  • Adjustment of parameters
  • Updating Quart and all packages
0

There are 0 best solutions below