A CRUD app made with Flask
Run the following commands in terminal
Setting up virtual environment
python3 -m venv .venvsource .venv/bin/activate
For ref: refer to: https://dev.mysql.com/doc/refman/8.4/en/installing.html
On MacOS(with homebrew)
brew install mysqlbrew services start mysqlbrew services list
On Linux
-
on Debian, Ubuntu and their derivatives
- Go to https://dev.mysql.com/downloads/
- Download mysql-apt-config_w.x.y-z_all.deb file.(artibrary values for version)
- Run
sudo dpkg -i /PATH/version-specific-package-name.debaccording to file location. For e.g. if in same folder,sudo dpkg -i mysql-apt-config_w.x.y-z_all.deb - Update the MySQL APT repo information with
sudo apt-get update - Install mysql-server with
sudo apt-get install mysql-server - Check mysql status with
systemctl status mysql - Start mysql with
systemctl start mysql
-
On Fedora, RHEL and their derivatives
-
Go to https://dev.mysql.com/downloads/repo/yum/ and download suitable package file
-
Install the download RPM package with
sudo yum localinstall mysql84-community-release-{platform}-{version-number}.noarch.rpm -
Check if it's installed with:
yum repolist enabled | grep mysql.*-communityExpected output:
mysql-8.4-lts-community MySQL 8.4 LTS Community Server mysql-tools-8.4-lts-community MySQL Tools 8.4 LTS Community -
Disabling the default MySQL module present in RHEL distros with:
sudo yum module disable mysql -
Install mysql with
sudo yum install mysql-community-server -
Start mysql server with
sudo systemctl start mysql -
Check status with
systemctl status mysql
-
-
On Arch Linux and its derivatives
- Install with pacman -
sudo pacman -S mariadb - Start the server with
sudo systemctl start mysql - Check status with
systemctl status mysql
- Install with pacman -
On windows
- Go to https://dev.mysql.com/downloads/installer/ and download the installer
- Run the installer and follow the installation steps
- Run the sql setup commands in mysql unicode shell
- Install the libraries with
pip install -r requirements.txt
-- Login to MySQL as root
mysql -u root -p
-- Create database
CREATE DATABASE backend_ex CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Create user (optional but recommended)
CREATE USER 'super_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON backend_ex.* TO 'super_user'@'localhost';
FLUSH PRIVILEGES;
-- Exit MySQL
EXIT;
Change the environment variables in .envfile
.env
SECRET_KEY=super-secret-key
SQLALCHEMY_DATABASE_URI=mysql+pymysql://super_user:password@localhost/backend_ex
- run the app with
python run.py
Check the api reference for Request and Response formats.
- Basic CRUD functionalities
- Create entries
- Read from Database
- Update entries
- Delete Entries
- Authentication
- Database integration
- Data validation with Marshmallow
Python:
- Flask
- Marshmallow
- SQLAlchemy
- Flask_login
- Flask_SQLAlchemy
- Werkzeug
Name: Sanjeev Yadav
Branch: CSE(DS)
Student No: 24154036
Roll No: 2400271540108