Skip to content

FHacKKer/CRUD_IN_PYTHON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask CRUD Application

A simple CRUD (Create, Read, Update, Delete) application built using Flask, a lightweight WSGI web application framework in Python. This project demonstrates the basic operations of managing user data.

Table of Contents

Introduction

This project is a basic web application that allows users to perform CRUD operations on user data. It uses Flask for the backend, a MySQL database for data storage (provided by Aiven), and Bootstrap for the frontend.

Features

  • Create: Add new users to the database.
  • Read: View a list of users.
  • Update: Edit existing user details.
  • Delete: Remove users from the database.

Installation

  1. Clone the repository:

    git clone https://github.com/FHacKKer/CRUD_IN_PYTHON.git
    cd CRUD_IN_PYTHON
  2. Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate # On Windows use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Set up the environment variables: Create a .env file in the root directory of the project and add the following variables:

    DB_HOST=YOUR_DB_HOST_HERE
    DB_USERNAME=YOUR_DB_USERNAME_HERE
    DB_PASSWORD=YOUR_DB_PASSWORD_HERE
    DB_DATABASE=YOUR_DB_DATABASE_HERE
    DB_PORT=YOUR_DB_PORT_HERE # default 3306
    JWT_SECRET_KEY=ANY_RANDOM_SECRET_KEY
  5. Run the application:

    flask run --reload --debug

Usage

  1. Access the application: Open your web browser and go to http://127.0.0.1:5000/.

  2. Perform CRUD operations:

    • Create: Fill in the form to add a new user.
    • Read: View the list of users on the home page.
    • Update: Click the edit button next to a user to update their details.
    • Delete: Click the delete button next to a user to remove them.

Environment Variables

Ensure you have the following environment variables set in a .env file in the root of your project:

DB_HOST=YOUR_DB_HOST_HERE
DB_USERNAME=YOUR_DB_USERNAME_HERE
DB_PASSWORD=YOUR_DB_PASSWORD_HERE
DB_DATABASE=YOUR_DB_DATABASE_HERE
DB_PORT=YOUR_DB_PORT_HERE # default 3306
JWT_SECRET_KEY=ANY_RANDOM_SECRET_KEY

Screenshots

Home Page Add User Edit User Delete User

Credits

This project was created by Faisal Shahzad (fhackker).

Special thanks to:

About

CRUD OPERATION IN PYTHON USING MYSQL DATABASE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published