Zach

Blog

Flask Yourself

4-02-2019

I’ve fielded some questions about what I used to make my site, and why I chose what I’ve used. This question, I believe, stems from a combination of curiosity and the confusing landscape of web libraries/frameworks. To help address the confusion portion of above question I thought I’d talk about how I concluded to use Flask (versus the million other options) and give a few references to get you started with Flask.

Why I chose Flask?

The reason I chose to use Flask for my website can be summarized in a short answer, I already knew Python, and I wanted to use a well-known framework that would enable me to create a website quickly and without getting buried in framework hierarchy.

How I arrived at this answer is the more complex portion of this question. Initially, I started looking at JavaScript (JS) frameworks, but because I wasn’t familiar with JavaScript I was going to be adding the task of learning JavaScript into the mix, as well as the framework/library of choice. I’m not opposed to learning both of those things at once, a matter of fact I enjoy it and I’m currently working on such a project now, but I felt the need to get a personal site up and running sooner rather than later.

By eliminating JS from the equation I was now looking for a Python, HTML/CSS method of creating my website, and this led me to two obvious choices: Django and Flask. I initially started down the path of using Django because it seemed like the most widely used of the two, and therefore the most applicable to a developer position. After spending time getting Django setup and experimenting with it, I decided that the framework overhead was too much for what I was aiming to accomplish. I felt like I was spending too much time dealing with Django and not enough time dealing with my website, especially since so much of what Django offered I wasn't going to be using. I was going for a clean, simplistic website that focused on the content.

After I concluded that Django wasn’t for this project, I turned to Flask. One of the things that drew me to Flask was its simplicity, and lack of built-in features. It was a basic framework that was designed to grow with your needs through the installation of Flask extensions. The simplicity that attracted me to Flask also scared me a little too. Was it so simplistic and barebones that the learning curve was going to be higher?

I spent some time watching tutorials and reading the Flask documentation, and after a fair amount of research (which led me to a great Microsoft Flask tutorial), I decided that Flask was the framework that would best fit my project and was very Pythonic (a perk for me). Now it was time to get started…

What did I use to get started?

I’ve had a subscription to Treehouse online learning for a couple of years now. I’ve used them as a resource to start learning Python, Flask, and many other things. The first thing I did was start a Flask lesson on Treehouse to get an idea of how it works and what I needed to do. This video was great to see things in action and to get a good overview, but I wanted to get a solid development setup for Flask and find some good references to help me along the way.

I spent some time online looking through Flask documentation, reading articles/tutorials, and searching for sites that I felt had useful information that I could reference later. While searching for information I came across a tutorial called “Flask Tutorial in Visual Studio Code” on the Microsoft Visual Studio Code documentation page that looked promising, plus I was using VS code already so this seemed like a reasonable tutorial to work through. This Microsoft documentation tutorial was excellent! I have nothing bad to say about it.

Depending on how far along you are in your development journey this Microsoft tutorial might contain some old information in it. However, if you are still pretty fresh in the developer journey, then this tutorial has steps and references to other documentation to get you started from a near zero starting point.

Now it was time to work through this tutorial, and I found it to be very well done, with sufficient details. This tutorial set the necessary foundation for me and allowed me to start experimenting with Flask on my local machine. Using what I learned in the tutorial I started building out a Flask project that would eventually become this website.

Now that I had the foundation for my Flask project configured and working I had to consider what style/layout I wanted:

As you can see, I had plenty to do and figure out still. Getting a barebones working Flask project was just one of the many steps required to get a functional website that I could be genuinely proud of sharing with the world. I plan to cover the next steps in this process in future posts.

If you have questions or comments, please feel free to reach out to me using any of the social links above.