I have a problem with django sessions.
This is the first time I’ve come across this.
When accessing request.session in two different views, I get two different SessionStore objects, so I don’t get variables from it.
I’m writing a variable in one view and I want to get it in another view, that’s all I need. All sessions are cleared, cookies are cleared and still the same result. I tried to make a delay of 2 seconds before going to another view in order to have time to write to the db, it does not help.
I only use the debug server and the default settings, in middleware the standard settings, I do not use the caches server. I use Django 5.0.7. Has anyone encountered this?
enter image description here
where do I write the variable
class SignYandexView(View):
def get(self, request):
client = oauth2.Client(client_id=os.getenv("YANDEX_CLIENT_ID"))
code_verifier = client.create_code_verifier(length=50)
code_challenge = client.create_code_challenge(code_verifier=code_verifier, code_challenge_method="S256")
request.session["code_verifier"] = code_verifier
print(request.session)
return redirect("....")
where do I want to get
class CallbackYandexView(View):
def get(self, request):
code = request.GET.get('code')
print(request.session)
code_verifier = request.session["code_verifier"]
x -5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.