Frappe.session.user returns wrong user account in portal pages

we were using frappe and ERPNext for the last six months. It was working perfectly AWS EC2 instance but after we try to setup production version in another instance it started acting weird. we have created custom app that uses our own template for our company specific business logic and was working perfectly in the development server. the problem is when user login to their portal page, because frappe.session.user not working correctly they see other users information in some routes(pages).

all our pages are in “www” folder and template files are in “templates” folder.

if we restart supervisor, it will work fine for the first logged in user. but for the next users it will show first logged in user information for some routes.

we used
" /api/method/login " for login and
" /api/method/logout " for logout

even we try to remove all the content from the *.py files, use the default frappe’s portal pages template but it didn’t help.

we have different users that will see different pages based on their role.


are returning wrong user information.

does anybody has suggestion? It’s urgent we are stuck at the final release for the last two weeks.

1 Like

we finally found out

no_cache = 1 is required in every .py file in the www folder of our custom app.

and run

bench clear-cache

It’s weird it was working fine in development server without above fixes.

1 Like