Python Flask Session Demo

← Back to Home

Code as Server Model: This demo uses a standalone Flask server running as a persistent process. Sessions are stored in-memory on the server, providing fast access but lost on server restart. Apache proxies requests to the Flask server running on port 5000.

Set Your Name





Session Pages

How It Works

  1. Enter your name and click "Set Name"
  2. Your name is stored in the server's memory (Flask session)
  3. Navigate between pages - your name persists
  4. The session is tied to a cookie in your browser
  5. Click "Destroy Session" to clear the server-side data

Comparing Session Storage

Approach Storage Location Persistence Speed
Flask (Code as Server) Server memory Lost on restart Fast
Python CGI File system (/tmp) Survives restart Slower (disk I/O)

← Back to Home