How to get session details from request in "doc" object in autoload()

Hi all,

I tried to integrate panel with Django.
I am referring the documentation : Documentation to integrate Django and Panel
Here I am loading data for dashboard using autoload(), but, for my use-case dashboard is user-specific, hence I have to get the session ID(username) from request.
But, the autoload() function passes parameter doc object instead of request.
So, I am unable to access username, in the pn_app().
Then i tried doc.session_context.request.session[‘username’], but it gives username for the first login, but if i login with different account in different browser, it gives me error

ERROR:bokeh.application.application:Error running application handler <bokeh.application.handlers.function.FunctionHandler object at 0x000002B37C3ECE20>: 'username' .

It would be very helpful if someone could help me out with this issue.

Please let me know if you need any more details.

1 Like