Exploring Web Development: A Journey with Flask. #
Choosing Flask as a Starting Point to Learn the Basics of Web Development
Why Flask? #
When venturing into the world of web development, choosing the right framework for your first steps can be a critical decision. Flask, a micro web framework for Python, has become a popular choice for beginners and seasoned developers alike. Its simplicity and flexibility make it an excellent starting point to grasp the fundamentals of web development.
One would quickly assume that no one in their right mind would consider learning a micro framework based on Python. Most, if not all, development is done with low-level programming languages for optimal performance. C, C++, Go, and Rust are four examples. I did not want to learn or become that low-level programmer, though, and wished for a more broad knowledge. Flask and Python brought that bridge to try almost everything, and I didn’t have to lose myself in the details of optimal performance and low-level tediousness. It taught me to build an API, yet also learn all techniques that revolve around a simple HTTP request and the technical challenges to protect an API. Even though my application has many dependencies and would never survive a huge scale, it still offered me the practical tools to learn what is necessary for app development.
Python as an Abstract Language and Useful Tool #
Python: The Swiss Army Knife
Python’s readability and versatility make it an ideal choice for web development. Its syntax is clear and concise, making it accessible for beginners while remaining powerful enough for advanced use cases. Whether you’re parsing data, building web servers, or automating tasks, Python’s vast ecosystem of libraries and frameworks has you covered.
The Design of an Application #
Database, Security, Data, Development Workflow, Caching, JavaScript/HTML
A well-designed web application is built on solid principles. Here are some crucial design choices to consider:
- Database: Choosing the right database technology, defining data models, and optimizing queries are critical steps. Flask’s integration with SQLAlchemy simplifies database interactions, allowing you to design robust data structures.
- Security: Security should always be a top priority. Flask-Security provides tools for handling user authentication, role-based access control, and secure data storage. I connected my authentication to my LDAP Free IPA server, allowing me even more solid security and a core understanding of LDAP.
- Data: Managing and presenting data effectively is at the core of web development. Flask’s templating engine makes it easy to create dynamic web pages, while JSON and RESTful APIs enable seamless data exchange.
- Development Workflow: Efficient development workflows involve version control (Git), testing, and deployment strategies. Understanding these tools and practices streamlines the development process. I’ve set up Github Actions for a seamless experience, allowing me to simply push any changes to my Master branch and automatically creating and pushing a Docker Image. Any small changes can instantly be fed into my production environment.
- Caching: Optimizing application performance through caching mechanisms can significantly enhance the user experience. Even though my application will never hold many users, caching with redis is a simple way to allow extensions and utilities to stay quick and responsive. Flask-Limiter, which allows me to limit requests, is one of the utilities that makes good use of caching and keeps bots and ddos-attacks less of a concern.
- JavaScript/HTML: Understanding the interplay between JavaScript and HTML is essential for creating dynamic web applications. As with Python, JavaScript kept me on my toes when it comes to OOP and gaining a more intricate and solid understanding of HTTP, requests, and overall web development.
Learning the Basics of HTTP, Git, REST API, and More #
HTTP: The Backbone of the Web
HTTP (Hypertext Transfer Protocol) is the foundation of web communication. Understanding HTTP methods, status codes, and headers is crucial for building web services and APIs. Flask simplifies HTTP request handling; I created a simple API using Flask Restful, which gave my blog application a solid API endpoint.
Git: Version Control Made Easy
After first setting up my Flask application, I soon wanted to get a grasp on version control. Git and Github were the obvious choice. Combining it with VSCode, I am now one click away from any updates, changes, or setting up my development environment anywhere I am.
REST API: Data Communication
REST (Representational State Transfer) principles guide the design of web APIs. Learning how to create and consume RESTful APIs is essential for building modern web applications. Flask-RESTful facilitates API development.
Basic Understanding of Linux and IT #
Navigating the Linux Landscape
Linux is the foundation of many web servers. Acquiring basic Linux skills, such as file navigation, permissions management, and server administration, enabled me to deploy and maintain my applications with confidence. It allowed me to set up VMs quickly, configure my Unraid server, and quickly navigate through any Linux distro to fix issues with the power of CLI, Bash, or Python.
IT Essentials
Understanding IT concepts like networking, domain management, and server configuration is valuable when deploying web applications. Familiarity with IT basics ensures a smooth transition from development to production.