Skip to content

A simple library management system built on top of python web framework flask. Old repo 👇

Notifications You must be signed in to change notification settings

hamza-avvan/library-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management System

A simple flask app to manage users along with mysql service now with docker support.

Libray Management App - Flask

Youtube Tutorial Walkthrough: https://www.youtube.com/watch?v=As90fkeMkyA

Installation

To run the app flawlessly, satisfy the requirements

pip install -r requirements.txt

Set Environment Variables

Replace .env.example with .env file and update the environment vaiables.

FLASK_APP=app.py
FLASK_ENV=development
FLASK_DEBUG=True

# DB info
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASSWORD=
MYSQL_DB=lms

Note: If you update the MYSQL_DB variable, remember to also update the corresponding value in the docker-compose.yaml file to ensure consistency when using Docker. There's an exceptioin for MYSQL_HOST which should set set within docker-compose.yaml file explicitly.

To setup a mail server you can set the below variable in .env file.

# SMTP credentials
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587 
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_USE_TLS=True
MAIL_USE_SSL=
MAIL_DEBUG=1
MAIL_DEFAULT_SENDER=sender@domain.com

I'm using Flask-Mail for managing emails. For more information, visit https://flask-mail.readthedocs.io/en/latest/

Setup Datbase

Export lms.sql database from within db directory using Phpmyadmin or terminal:

mysql -u <username> -p <password> lms < lms.sql

Start Server

flask run

Or run this command

python -m flask run

Debugging

Start flask with auto reload on code change

flask run --reload

Getting Started with Docker

With this update, you can now easily get an out-of-the-box support for a Docker environment. There's no need to set up a mysql service, import databases, or run multiple commands.

Create an .env file as described in the Set Environment Variables section, then execute the docker-compose command. This will automate the entire setup process for you.

Build & start the app:

docker-compose up --build

OR

Start app (without building):

docker-compose up