miguelgrinberg.com

订阅源链接共 18 篇文章

SQLAlchemy 2 In Practice - Chapter 3 - One-To-Many Relationships

This is the third chapter of my SQLAlchemy 2 in Practice book. If you'd like to support my work, I encourage you to buy this book, either directly from my store or on Amazon . Thank you! In the previous chapter you learned how to execute a variety of queries on the products table. Interestingly, some of those queries were designed to obtain product manufacturers and not products, and this required duplicates to be removed by grouping the results.

2026-04-02 10:17原文链接
未翻译

SQLAlchemy 2 In Practice - Chapter 2 - Database Tables

This is the second chapter of my SQLAlchemy 2 in Practice book. If you'd like to support my work, I encourage you to buy this book, either directly from my store or on Amazon . Thank you! This chapter provides an overview of the most basic usage of the SQLAlchemy library to create, update and query database tables.

2026-03-26 12:30原文链接
未翻译

SQLAlchemy 2 In Practice - Chapter 1 - Database Setup

Welcome! This is the start of a journey which I hope will provide you with many new tricks to improve how you work with relational databases in your Python applications. Given that this is a hands-on book, this first chapter is dedicated to help you set up your system with a database, so that you can run all the examples and exercises. This is the first chapter of my SQLAlchemy 2 in Practice book. If you'd like to support my work, I encourage you to buy this book, either directly from my store o...

2026-03-19 23:25原文链接
未翻译

Introduction to SQLAlchemy 2 In Practice

In 2023 I wrote " SQLAlchemy 2 In Practice ", a book in which I offer an in-depth look at SQLAlchemy version 2 , still the current version today. SQLAlchemy is, for those who don't know, the most popular database library and Object-Request Mapper (ORM) for Python. I have a tradition of publishing my books on this blog to read for free, but this is one that I never managed to bring here, and starting today I'm going to work on correcting that. This article includes the Preface of the book. If you...

2026-03-12 09:43原文链接
未翻译

How to Host your Own Email Server

I recently started a new platform where I sell my books and courses, and in this website I needed to send account related emails to my users for things such as email address verification and password reset requests. The reasonable option that is often suggested is to use a paid email service such as Mailgun or SendGrid. Sending emails on your own is, according to the Internet, too difficult. Because the prospect of adding yet another dependency on Big Tech is depressing, I decided to go against ...

2026-03-06 16:10原文链接
未翻译

LLM Use in the Python Source Code

There is a trick that is spreading through social media. If you block the claude user on GitHub, then each time you visit a GitHub repository that has commits by this user you get a banner at the top alerting you of the user's participation. It's an easy way to spot projects that have started to rely on coding agents, in this case on Claude Code specifically. Imagine the surprise when you see that CPython , one of the most popular open-source projects in the world, is now receiving contributions...

2026-02-28 15:14原文链接
未翻译

My Courses Site is Moving to a New Home

This is a short blog post to announce that I'm migrating the site in which I host my paid courses to a new platform at https://learn.miguelgrinberg.com . If you have purchased a course or ebook directly from me, this article tells you how to transfer your account to the new site.

2026-02-15 15:15原文链接
未翻译

Date Arithmetic in Bash

Date and time management libraries in many programming languages are famously bad. Python's datetime module comes to mind as one of the best (worst?) examples, and so does JavaScript's Date class . It feels like these libraries could not have been made worse on purpose, or so I thought until today, when I needed to implement some date calculations in a backup rotation script written in bash. So, if you wanted to learn how to perform date and time arithmetic in your bash scripts, you've come to t...

2026-02-04 11:09原文链接
未翻译

How to Add a Quick Interactive Map to your Website

In this article I want to share a technique that I recently learned to display an interactive map on a website. For this, you will need just a few lines of HTML and JavaScript. This solution does not require you to sign up for any accounts or services anywhere, it is completely free and open source, and can be integrated with any front or back end web framework. Give the demo below a try and if you like it, then keep on reading to learn how you can add a map like this one to your website in just...

2026-01-29 12:25原文链接
未翻译

A Year In Review: Flask in 2025

Like I did last year , I reserved some time during my holiday break to prepare an independent report of the Flask ecosystem in 2025.

2026-01-01 12:00原文链接
未翻译

CSRF Protection without Tokens or Hidden Form Fields

A couple of months ago, I received a request from a random Internet user to add CSRF protection to my little web framework Microdot , and I thought it was a fantastic idea. When I set off to do this work in early November I expected I was going to have to deal with anti-CSRF tokens, double-submit cookies and hidden form fields, pretty much the traditional elements that we have used to build a defense against CSRF for years. And I did start along this tedious route. But then I bumped into a new w...

2025-12-21 15:54原文链接
未翻译

How to Securely Store Secrets in Environment Variables

You may have seen the recent reports of a malware that stole API keys, tokens and other secrets from a large number of developers. From where were these secrets stolen from? You guessed it, they were mostly stolen from environment variables. We use environment variables to configure information that processes need to run, but this type of storage was not designed for security, so using the environment for secrets always comes with risk. Given how serious this recent attack was, I thought it woul...

2025-12-14 15:33原文链接
未翻译

Python 3.14 Is Here. How Fast Is It?

In November of 2024 I wrote a blog post titled "Is Python Really That Slow?" , in which I tested several versions of Python and noted the steady progress the language has been making in terms of performance. Today is the 8th of October 2025, just a day after the official release of Python 3.14. Let's rerun the benchmarks to find out how fast the new version of Python is!

2025-10-08 13:09原文链接
未翻译

Benchmarking MicroPython

In the Q&A session following my EuroPython 2025 presentation about the Microdot web framework, a member of the audience asked me what the performance of MicroPython running on a microcontroller is. This took me a bit by surprise, because I really had no way to quantify it, I just knew it was, in vague terms, not great. I never questioned the low performance, because it was never a problem for me. My answer to the question was that microcontrollers cannot replace a computer, and that these de...

2025-07-31 14:54原文链接
未翻译

Why Generative AI Coding Tools and Agents Do Not Work For Me

People keep asking me If I use Generative AI tools for coding and what I think of them, so this is my effort to put my thoughts in writing, so that I can send people here instead of having to repeat myself every time I get the question. From the title you already know that this isn't a pro-AI blog post. But it isn't an anti-AI post either, at least I don't think it is. There are already plenty of articles by AI promoters and AI critics, so I don't feel there is a need for me to write one more of...

2025-06-14 15:39原文链接
未翻译

Create a React + Flask Project in 2025

My article on creating a React + Flask project is one of the most visited on this blog. Can you believe that I wrote it over 5 years ago? In this article and video I'm going to share how I'm building this type of project in 2025. The main change I've introduced since I documented my 2020 process is that now I'm using Vite (French word that is pronounced "veet" and means "quick") instead of create-react-app to scaffold the React application, since the latter isn't maintained anymore.

2025-05-31 18:13原文链接
未翻译

Font Ligatures for your Code Editor and Terminal

The other day I shared my code editor window during a video call with a client, and he immediately did a double take. "How did you make your code look like that?", he wanted to know. Have a look at the following screenshot and see if like my client, anything calls your attention: If you are wondering what secret keyboard trick allows you to type ≠ , ≤ , ≥ and other unusual characters, and then how to get Python and other programming languages to accept them then read on, as this is much easier t...

2025-03-13 16:10原文链接
未翻译

A Review of The Quick Python Book, Fourth Edition

I've been given a review copy of The Quick Python Book, Fourth Edition by Naomi Ceder, published by Manning. Since I often get asked for Python book recommendations, I thought it would be a good idea to share a review, in case you are looking for material to sharpen your Python skills.

2025-02-27 18:49原文链接
未翻译