JPete.Dev Books
Page updated 31/10/22: updated links to Website.
Introduction
“JPete Books” is a website built with the Flask micro-framework for Python. I consider this to be my second major side project (after the MERN full stack project), and is loosely based of a University assignment project using the Flask framework.
I chose to create and work on this project to solidify my understanding of the Flask framework, as well as my general Python and HTML programming skills.
How it Functions
The website functions using the Jinja templating engine for rendering the different web pages and sections, with the data required being sourced from a SQL Database, which is queried using SQLAlchemy / Flask-SQLAlchemy.
Project Setup / Tools
My process for creating / working on this project involves using Notion and the Trello-like board to track my progress working on the project.
In addition to using the Board template, I used Notion to plan out the overall project, such as what pages the website should contain, what fields and tables the database needs to have, without having to make any changes to the code or database.
Challenges
There were not many 'challenges' in this project that I encountered, since I have prior experience in working with Flask. The challenges I did face came from working with the template engine Jinja2, which is used to render the HTML templates for the site, and those involved rendering specific information from a SQL database using conditionals.
For example:
This code renders and provides options for different Sub-Genres of books depending on the main Genre (such as science fiction for the Fiction genre)
Things I Learnt
While I didn't explicitly learn anything new in this project, I used it to reinforce already existing skills.
One of the things that I did learn was array manipulation in Jinja (which was how I limited the number of example books on the website landing page); which used the standard Python array syntax, e.g. `items[:6]`, 'items' is the term I used to represent data queried from the MySQL Database.
Doing Things Differently
While this project is relatively simple, there are some things that I would do differently if I were to re-create this project:
- Have an explicit UI/UX design fleshed out before writing any HTML
- Have the SQL database have all the necessary data required for creating pages, to help ensure that there are no outlying errors
- Use other public domain media other than Books to make the site more interesting content-wise
- Probably using other database solutions other than MySQL