Flask
-
12 Days of DigitalOcean: Your Complete Guide
Last month, I joined DigitalOcean and decided to dive in by building something fun and practical. That’s how the 12 Days of DigitalOcean series came to life—a step-by-step journey to create two real-world apps while exploring DigitalOcean’s ecosystem. Here’s what we built: Birthday Reminder Service: A serverless app that sends SMS reminders for upcoming birthdays. Email Receipt Processor: A tool that processes emailed receipts and organizes their details in a database. These apps aren’t just examples—they’re tools I now use…
-
12 Days of DigitalOcean (Day 12) – Sending Confirmation Emails with Resend
Welcome to the final day of our 12 Days of DigitalOcean series! We’ve come a long way, building an Email-Based Receipt Processing Service that extracts receipt details from Postmark using DigitalOcean’s GenAI Agent, securely stores attachments in DigitalOcean Spaces, and saves the extracted data in Google Sheets. Today, we’ll add the final touch—sending confirmation emails back to the sender with the receipt details, attachment links, and a link to the Google Spreadsheet. This final step ties everything together, ensuring that…
-
How To Perform Unit Testing in Flask
Introduction Testing is essential to the software development process, ensuring that code behaves as expected and is defect-free. In Python, pytest is a popular testing framework that offers several advantages over the standard unit test module, which is a built-in Python testing framework and is part of the standard library. pytest includes a simpler syntax, better output, powerful fixtures, and a rich plugin ecosystem. This tutorial will guide you through setting up a Flask application, integrating pytest fixtures, and writing…
-
How To Create a REST API with Flask on Ubuntu
Introduction In this tutorial, you will learn how to create a simple REST API using Flask, a lightweight Python web framework. We’ll cover the basics of setting up a Flask application, defining routes, handling requests, and returning JSON responses. By the end of this tutorial, you will have a working API that you can extend and integrate with other applications. Prerequisites A server running Ubuntu and a non-root user with sudo privileges and an active firewall. For guidance on how…
-
How To Handle Errors in a Flask Application
The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program. Introduction Flask is a lightweight Python web framework that provides useful tools and features for creating web applications in the Python Language. When you’re developing a web application, you will inevitably run into situations where your application behaves in a way contrary to what you expected. You might misspell a variable, misuse a for loop, or construct an if…
-
How To Use Templates in a Flask Application
The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program. Introduction Flask is a lightweight Python web framework that provides useful tools and features for creating web applications in the Python Language. When developing a web application, it is important to separate business logic from presentation logic. Business logic is what handles user requests and talks to the database to build an appropriate response. Presentation logic is how the…
-
How To Create Your First Web Application Using Flask and Python 3
The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program. Introduction Flask is a lightweight Python web framework that provides useful tools and features for creating web applications in the Python Language. It gives developers flexibility and is an accessible framework for new developers because you can build a web application quickly using only a single Python file. Flask is also extensible and doesn’t force a particular directory structure…
-
How To Use Web Forms in a Flask Application
The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program. Introduction Web forms, such as text fields and text areas, give users the ability to send data to your application to use it to perform an action, or to send larger areas of text to the application. For example, in a social media application, you might give users a box where they can add new content to their pages.…
-
How To Use Many-to-Many Database Relationships with Flask-SQLAlchemy
The author selected the Free and Open Source Fund to receive a donation as part of the Write for DOnations program. Introduction Flask is a lightweight Python web framework that provides useful tools and features for creating web applications in the Python Language. SQLAlchemy is an SQL toolkit that provides efficient and high-performing database access for relational databases. It provides ways to interact with several database engines such as SQLite, MySQL, and PostgreSQL. It gives you access to the database’s…