This blog is nothing more than a personal project. I wanted to get an idea of how things work in Flask, connect them to DB, understand and learn HTML and CSS. I won't lie, this entire experience was extremely fun. There's something special about creating something from scratch, it is fun, and you learn of things you wouldn't have known otherwise. This website wasn't anything more than a Wordpress website initially, but over time, I kind of saw how hard it is to customize anything in Wordpress. Hence this.
Stack
Let's discuss the libraries, packages, frameworks, and all the gobbledyegook I used to develop this blog.
The languages used to develop this were - Flask, HTML, CSS.
The entire frontend is pretty much just HTML and CSS.
For Backend, we went ahead with Python - Flask, and FlaskSQLAlchemy.
A brief of how it works
Overview
So, you develop routes with Flask, and all the routes render an HTML and CSS. These templates can be excessively customized, and can use whatever Python variables you pass into them.
For the data handling, I used FlaskSQLAlchemy. This is pretty much a wrapper around SQL. You can do a bunch of stuff with it, querying the db, doing complex SQL queries.
The structure ends up looking like this.
>dir
│ app.py
│ config.py
│ md_html_conversions.py
│ models.py
│ requirements.txt
│
├───instance
│ project.db
│
├───static
│ ├───css
│ │ main_page.css
│ │
│ └───images
│ human_body copy.jpg
│ human_body.jpg
│
├───templates
│ 404.html
│ aboutme_page.html
│ archive_page.html
│ article_page.html
│ main_page.html
│ sera.html
│ tags_page.html
│
└───includes
navbar.html
sidebar.html
Some extra information about everything mentioned.
app.py is the main handler. It takes care of all routes, and everything. config.py takes care of all the Flask configurations, and DB connections. md_html_conversions.py is a file I use to convert all the Markdown documents into an HTML. Even this was written natively in a Markdown. models.py is everything database. Setting up a table, class variables, and creating functions that take care of SQL operations.
Everything else is self explanatory.
I had a MASSIVE HELP from Claude's Haiku. Amazing model. I needed help in understanding how the db should be structured, and how SQLAlchemy works. Great stuff man, highly recommend.
Hosting
I think this was the most confusing part of it all. To be fair, I am not very sure of how I did everything, but the rough gist of it all is - I got myself a small droplet on DigitalOcean, set up Nginx, changed the default site-enabled to my own, set up a reverse proxy for localhost, installed Gunicorn, and ran the web application. I've attached a bunch of tutorials I followed, and I am pretty sure they'll help.
Closing Notes
That's all man. This isn't going to be a tech blog. This is NOT going to be an educational blog. This is my personal blog for personal things. There's no theme, it's just text.