M
M
Maxim Yakovenko2020-01-31 19:13:48
Django
Maxim Yakovenko, 2020-01-31 19:13:48

Shared session for Flask and Django applications. Is it possible?

Good day.

There are two applications, one in Django and one in Flask.

Initially, the project lives on Django, and the latest extensions go to Flask. But the main business logic lies with Django, including authorization, sessions, etc.

There is no strong desire to write SSO now, as time is running out.
Hence the next question, how can I take session data from a django application, and embed it in Flask?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-01-31
@bacon

And what was the point of attaching Flask? If you don't want SSO, then either a simplified version of SSO - some kind of handle in django to check the session, accessible from within the network, or read data from the django_session table.

M
Maxim Yakovenko, 2020-02-08
@TheLazzziest

Perhaps this will be useful to someone, but flask-session + flask_login was enough for me, only a slightly modified version as part of the storage search key.
Conceptually it looks like this.
Expose the host common to the cookies of both services. Set the configuration for flask-session to match the default django configurations for working with a session. And flask-login has a session record search key. And then, just do all the authentication activities on django, and then go to the flask-a pages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question