Skip to content

macloo/flask-db-app

Repository files navigation

A Flask app using a MySQL database

Detailed information about this project is in this document:

Flask app with a MySQL database

All the app code is in the file database_app.py

In the /database folder, there is a database table you can import and use (if you don't have your own). The README in that folder explains how to set it up using phpMyAdmin.

Because this repo is created for students using XAMPP (which works on both Mac and Windows), our database management system is MariaDB.

Students are expected to deploy their Flask app on a standard web server via a shared hosting account. They can do this using cPanel via these instructions.

This combination is convenient for teaching, because students need not pay for additional services, and they retain control of their app, database and files after the course ends, because they are responsible for their own web hosting account.

As the typical shared hosting account has cPanel and phpMyAdmin by default, students are spared the additional work of setting up a MySQL server on their own.

The edit-db branch

Switch to the edit-db branch to see how to insert a new record into the database using Flask-SQLAlchemy. In that branch, you can also:

  • Edit and delete records.
  • View all records.