flask clear session on click on the home link

  flask, python

I want to clear the session if someone clicks on the Home button or Site name.

Home Link:

<a href="{{ url_for('index') }}" ><h1>Home</h1></a>

I tried this

<a href="{{ session.clear(); url_for('index') }}" ><h1>Home</h1></a>

But this errored out.

Is there any way to include the session clear in this jinja2 template for the home link?

Source: Python Questions

LEAVE A COMMENT