The session is unavailable because no secret key was set. code example
Example: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.
if __name__ == "__main__":
app.secret_key = 'super secret key'
app.config['SESSION_TYPE'] = 'filesystem'
sess.init_app(app)
app.debug = True
app.run()