A ready to go script with example for Flask Restful API connecting to a MySQL Database using SQLAlchemy ORM
These are the steps I use to get started quickly with programming. You are free to use any method/virtual environment to get going.
- Python 3.6 or higher installed
- MySQL Database ready to go. Please edit the DB_URL in models.py
- Create a table in MySQL called Users with idusers as primary key and email, username, password as other text fields.
python3 -m venv myproject
cd myproject/
source bin/activate
pip install -r requirements.txt
python app.py
Flask-RESTful provides the building blocks for creating a great REST API.
You'll find the user guide and all documentation here
The Python SQL Toolkit and Object Relational Mapper
Latest documentation is at:
http://www.sqlalchemy.org/docs/
Full documentation for installation is at:
Installation here
Please refer to the SQLAlchemy Community Guide here