This GitHub Repo contains all of the files created during the Python Classes Live Coding Seminar.
Throughout the seminar, a basic Flask application was created which performs all basic CRUD operations on a MongoDB database.
This python file is the initial Flask application, where the functionality is implemented using basic and procedural programming.
These python files demonstrate the refactored functionality, replacing the basic and procedural functionality with re-usable, clear, and seperated functions.
These python files demonstrate how recurring data structures and their associated methods can be grouped into classes, to allow for the appropriate seperation of concerns, and improved readability of code.
These folders hold the neccessary HTML and CSS required for Flask and Python to generate web content.
In order to test this code, please run pip install -r requirements.txt
.
You will need the following environment variables:
"SECRET_KEY"
"MONGO_URI"
"MONGO_DBNAME"
Run the program with python app.py
.
Note:
Whichever method of implementation you would like to test (basic, functions, or classes), replace the app.py
file with the chosen file. For example, change app.py
to app_classes.py
and rename app_function.py
to app.py
if you would like to test the flask application using the functions implemented throughout the serminar.
For interesting takes on Classes in Python, please see Stop Writing Classes, Start Writing More Classes, and Stop Writing Stupid Classes.