Debugging this reveals the following: Since the session has been updated, django tries to save it in the db. But the session there does not exist. Since the session save is done with parameter "force_update" (in django.contrib.sessions.backends.db.py called from django.contrib.sessions.backe...
@app.route('/check_session') def check_session():if'my_key'insession:return'Session data exists.'else:return'Session data does not exist.' AI代码助手复制代码 删除会话数据: @app.route('/delete_session')defdelete_session(): session.pop('my_key',None)return'Session data deleted.' AI代码...
When the key does not exist in Redis, theget()returnsNoneand thisNonegets passed as a string todecode(). In Django 3decode()silently detected the error and returned an empty session, Django 4 additionally emits a log that the session data is corrupt. Approach Handle case wheregetin Redis ...
When the key does not exist in Redis, the `get()` returns `None` and previously this `None` got passed as a string to `decode()``. In Django 3 `decode()`` silently detected the error and returned an empty session, Django 4 additionally emits a log that the session data is corrupt...
(request,'User Does Not Exist !') try: user_authe = User_login.objects.get(user_auth=user, is_vendor_user='n',is_customer_user='y') user = authenticate(request, username= username, password = password) if user is not None: login(request, user) return redirect('home') else: ...