Skip to content

Latest commit

 

History

History

flask-redis-session

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Flask Redis Session Management

This is a simple Flask web application that demonstrates user session management using Redis as the session storage. It allows users to log in, manage a shopping cart, and tracks their visits. The application is designed to showcase how to handle user sessions, maintain user data, and implement secure session management.

Prerequisites

Before running the application, ensure you have the following prerequisites installed:

Installation and Usage

  1. Clone the repository:
git clone https://github.com/aws-samples/amazon-elasticache-samples.git
cd webinars/flask-redis-session
  1. Install the requirements
pip install requirements.txt
  1. Set the application variable
export FLASK_APP=sessionstore.py 
export SECRET_KEY=test 
export REDIS_URL=test1.XXXXXX.clustercfg.use1.cache.amazonaws.com
  1. Installation and Usage
flask run -h 0.0.0.0 -p 5000 --reload

Features

User login and session management.

Access application using browser

Application Screenshot

Login to the application with /login

Application Screenshot

Shopping cart management for logged-in users.

Add itemns to cart Application Screenshot

Visits count for each user.

Reload the browser to see updated visits count

Secure session token generation and management.

Access from a differrent browser with same userid to see the session data retrieved and count updated

Application Screenshot

Displays expired user sessions.

For all logged out users keep track of with with /expired_users Application Screenshot