Hi! In this series of posts, I will walk over how to build a static website using Python and HTML. It will be very useful if you already have some basic knowledge of each one of those. You won’t need to be an expert in either though!
In this post, I will tell you what to expect from this series. I will be showing you how to create your own static website and hosting it for free! I will also go over how to automate the deployment of the website, so it’s easier to update it with new projects and content. In a nutshell, you will learn how to create a static website generator, and as a bonus, it will have a continuous deployment workflow.
All the development stages will be updated on a dedicated GitHub repository at https://github.com/regisin/simple_static_website
What is a static website?
Well, it’s a website that does not generate its pages dynamically. For example, you know when you post something on social media and a few seconds later your friends can see it in their own feed the thing you just posted? That is a dynamic website. It requires some powerful machines to run such a website. You need a database, a web server, and perhaps other tools running on a server. It can be a lot of work to set it all up, especially if you are working by yourself.
A static website, on the other hand, is made of static files that a browser can fetch from a server. It does not change dynamically. In order for the content to change, the files themselves will have to be updated, by hand. Sounds awful, doesn’t it? Why would I even bother to create a static site if it needs so much manual labor…
If you are a beginner, or if learning how to use static website frameworks is just not for you, you may benefit from this series of posts. In this series, we will make a static website with SOME level of automation. The pages will be generated offline before being served and not in real-time like the social media example, and we’ll be using plain Python and HTML templates to do that.
So why generate static pages for a website?
It may seem counterintuitive to even consider creating a static website after all these years with so many advanced tools out there. But I will make the point that not all websites need to have a powerful backend and even a proper database. There are many use cases where dynamic content is not required at all! And having static pages gets the message across and saves valuable time that could be used in more meaningful tasks.
Personal websites are the perfect example. It’s a personal website, it’s not a web app. You might have a personal blog on your website, and that’s totally cool. But let me ask you, how often do you update a blog? How often do you finish a new project to add to your personal portfolio? For most people, not that often.
Objectives of this series
In this series, we will learn how to use python and HTML to build a personal website. There are other static website generators out there, such as Jekyll (which is awesome, by the way, but I ain’t got time for that!), but the purpose of this series is to make your life even easier, without having to learn yet another tool (Jekyll) to create a website.
All you need to know is some basic HTML, and some python.
We will use GitHub to host our personal website for free, and also use Travis-CI to simplify the publishing process of the site when you update it with new content.
This series is targeted at folks that already have some knowledge of how the web works. You know a little bit of Python, how to create a script, how to load and read text files from a Python script. You are looking for simple alternatives to common tools to build sites such as WordPress, Joomla, Drupal, etc that can be TOO feature-rich. Or if you don’t have the resources to maintain a server yourself running a backend framework such as Django.
In this series, you will not have to spend a dime and will end up with a simple, yet personal and customizable website.