A simple Flask REST API project demonstrating CRUD operations and database management with SQLite, SQLAlchemy ORM, and Marshmallow serialization. Python Flask CRUD App | Build Full Stack Web App with SQLite https://youtu.be/6A-Et2R4lvM Flask REST API Tutorial | Step-by-Step for Beginners https://youtube.com/live/vna41vlEmqg?feature=share
-
Flask backend API with SQLite database
-
SQLAlchemy ORM models for
UserandStudent -
Database management CLI commands:
flask db_create- create database tablesflask db_drop- drop all tablesflask db_seed- seed database with sample data
-
API endpoints with URL parameters and query parameters
-
JSON responses using Flask’s
jsonify -
Input handling with Flask’s
request
-
Clone this repository
git clone https://github.com/manibalasinha/PythonFlask.git cd PythonFlask -
(Optional but recommended) Create a virtual environment and activate it
python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Create the database tables
flask db_create
-
Seed the database with sample data
flask db_seed
-
Run the Flask app
flask run
-
Open your browser or API client and test the endpoints:
GET /- Welcome messageGET /shorts- Simple JSON messageGET /not_found- 404 JSON responseGET /parameters?name=John&age=20- Parameterized responseGET /url_variables/John/20- URL path variables responseGET /students- Get all students in the database
PythonFlask/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── students.db # SQLite database file (generated)
└── README.md # This file
- Flask
- Flask-SQLAlchemy
- SQLAlchemy
- Marshmallow
- Flask-Marshmallow
- Database URI is set to a local SQLite file at
C:\Users\manib\FlaskPython\students.db. Adjust path inapp.pyif needed. - Use Flask CLI commands to manage your database easily.
This project is licensed under the MIT License.