Creating a Real-Life Flask Application
Getting into Python web development should be fun and practical.
Right now, there’s a few tutorials showcasing simple applications and a few open source projects which people can learn from. The tutorials are covering various aspects and important concepts, but few really overlap with issues concerning long-term maintenance, real-world issues which crop up and important aspects of making a project successful.
Let’s change that! This is the start of a mix: a real-world web development project and tutorial series featuring Flask.
I’d like to use this to be a case study for a very hands-on example of developing and hosting a small web application, iterating on an initial idea and fixing stuff which comes up and improving it with the users in mind. You know, almost-real-world-stuff :)
The Problem to Solve
Usually you want to have a good reason for a project. Well, it’s more of a pet peeve in this case.
I love music! Among others, Listening to it through Spotify while working. For me, especially album art can add to the enjoyment when the conscious mind wanders while working out some small issue.
Unfortunately, my Spotify clients on Linux, Mac and iOS all don’t make it easy to view the current song’s album art at anything approximating a fullscreen size. That always bugged me a bit.
Recently the Spotify web API got a new endpoint, which delivers information about the currently playing song. Previously it wasn’t available.
So, given that I’m still a bit annoyed about the state of things, that it’s easy to get the current song and display the image via its url on a website and I’m looking to create something in the open to help other people get started with web development: Neat-o.
Regarding choice of language, I prefer Python to Golang, apart for web services which suit the channel-communication style especially well or can greatly benefit from making it easy to think about concurrency.
While co-founding a startup recently, we were using Django for our product - and loving it. It’s very opinionated, lots of batteries-included for bigger applications and a large community. Once you get started and into the groove of things, you can focus on getting things done.
Flask is great for small web applications. Of course you can use it for larger projects as well, but I haven’t yet. Gonna stick to my comfort zone on this one.
In my perception, a beginner will have an easier time understanding something which is as-small-as-necessary without details which might help on a bigger project but are not necessary to get started.
Thus, the app will be written in Python using the Flask framework and as many additional Python modules as necessary to make it work.
For hosting, I want to start out with a more complex solution and go into simpler options in the course of explaining it. The hosting will take place on an AWS Amazon Linux instance, using Nginx, Dockerized dependencies (Redis, PostgreSQL) and the app itself through Gunicorn for convenience.
The frontend might make use of Vue.js eventually, but will be kept simple for now.
The app is already online it its prototyped glory, and the code is on Github. It needs a lot of love on the usability-front, and there’s a lengthy list of issues which are necessary to make it technically sound. We’ll work those out eventually :)
The next posts will consist of diving into single aspects of developing a web app in Flask, important concepts and things I should have gotten right from the get-go.
If you want to join in on the fun, and be notified about the next post, just drop me your favorite email address below and I’ll be in touch!
Join the mailing list!
Subscribe to get notified about future articles and stay in touch via email.
I write about Kubernetes, Docker, automation- and deployment topics, but would also like to keep you up to date about news around the business-side of things.