- Flask RESTful API request parameter validation with Marshmallow schemas
- Flask SQLAlchemy CRUD application with WTForms QuerySelectField and QuerySelectMultipleField
- Migrating from Bootstrap 4 to Bootstrap 5
- Using Python's pyOpenSSL to verify SSL certificates downloaded from a host
- Why your website canonical name must be 'www' (or 'app' or something else)
- Flask's SERVER_NAME, subdomains and 404 errors
- Flask, WTForms and AJAX: CSRF protection, before_request and multilanguage
- Do not hesitate to reinvent the wheel if you want your software with open source components to live longer
- Using icons on your Flask website and reducing 'First Contentful Paint'
- Threaded comments using Common Table Expressions (CTE) for a MySQL Flask blog or CMS
- Migrating from Bootstrap 4 to Bootstrap 5
- Using UUIDs instead of Integer Autoincrement Primary Keys with SQLAlchemy and MariaDb
30 March 2021 0
When you build a RESTful API the first thing you do is define the status codes and error responses. RFC 7807 'Problem Details for HTTP APIs' specifies the minimum parameters you should return. If you did not looked into this, I suggest you do. Of course you often want to include more details about what went wrong. APIs are for developers and we do want to make it easy for them to understand why a call ...
8 March 2021 0
For a new Flask application using WTForms and SQLAlchemy, I had many relationships between tables and was looking for the easiest way to manage these tables. The most obvious choice is to use the QuerySelectField and QuerySelectMultipleField present in the wtforms-sqlalchemy package. Since I haven't used them before, I created a small application to play with. Below I show you the code (development ...
17 January 2021 0
17 December 2020 0
While writing a script to check if websites correctly redirected to 'https:/www.' I thought to add some SSL certificate checks as well. This means I had to verify SSL certificates downloaded from a host. Is the certificate really for this website? Show me the expiration date. Is the certificate chain correct? And can we trust the certificate(s)? Initially I got stuck where many people got stuck because ...
27 November 2020 2
I know, there are many articles about this subject. But I thought it was useful to write a post about this because I did not know all the details. I assume your website can be accessed from the internet using a 'without-www' URL and a 'with-www' URL. This article is not about selecting a website URL for marketing purposes. Even if you are using a 'with-www' URL for your website, you can still communicate ...
25 November 2020 1
This is a short post about Flask and the config variable SERVER_NAME. Like many developers I bumped into this at a certain moment, and I thought I share my story. Hopefully this will prevent headaches for some. My websites must be available by typing the following addresses in the browser: https://example.com = 'without-www', and, https://www.example.com = 'with-www' Whats more, for this ...
29 October 2020 0
This is a post about how I use Docker and Docker-composer to develop and run my Flask website with Celery and Redis. There are many articles on the internet about this and if you are searching for them do not forget to search on Github.com. I just grabbed the bits and pieces and created my own setup. Before going into this I want to mention two other things that came up when adding Celery to Flask. The ...
10 October 2020 0
Being able to run asynchronous tasks from your web application is in many cases a must have. One way to achieve this is to use Celery. There are many articles on the internet and some examples are given. I really liked Miguel Grinberg's posts about Celery. Very clear, thank you Miguel. But Miguel's post and most other articles are just an introduction. When you start with Celery you suddenly realize ...
30 September 2020 0
I developed one Flask website on Docker but after some time when my code became more stable I wanted to use the same setup for other websites. For one website I made a copy because it had to work yesterday. But what I really wanted was to share all the code, and some of templates. Of course every website has its own static directory, logging directory, templates, etc. The main reason for sharing is ...
22 September 2020 0
This is a short post about something I wanted to do a long time ago and for which I finally found some time. It was not really a case of TL;DR (Too Long; didn't read), but more something like TLT;DR (Too Little Time; didn't read). As you probably know, the Docker .dockerignore file is used to prevent certain files and directories ending up in your Docker image. The Docker .dockerignore file is used ...
20 August 2020 0
The problem: I have a website that sends emails. The emails (meta) are stored in a database before sending to the Postfix MTA. Every email the website sends has a unique message-id, something like firstname.lastname@example.org. I want to check if the emails are actually sent and add this information to the email (meta) database records. Postfix has statuses like: status=bounced ...
25 July 2020 0
Testing is hard work. It is totally different from creating or modifying functionality. I know, I also developed computer hardware, integrated circuits, hardware test systems. I wrote tests for CPUs, computer products, developed test systems. With hardware you cannot make mistakes. Mistakes may be the end of your company. Welcome to the wonderful world of software testing With software many things ...
26 June 2020 0
I decided to temporarily shift focus from developing the software for my CMS / Blog to a smaller project. Main reason is that I hoped to learn new things about Python that are useful. I always wanted to have my own IMAP client software. Maybe my choice was also heavily influenced by some annoyance about the IMAP client Dekko2 for Ubuntu Touch, the OS of my mobile phone. I know that I should be happy ...
17 June 2020 0
When searching for something on the internet you sometimes bump into an article that perfectly describes what you are already telling friends, colleagues for many years. Whether you are a publisher, a software developer, an advertising company, this Trevor Jim's article is a must-read. Here are the first lines: Internet advertising is a company town February 28, 2017 If you’ve watched a lot ...
17 June 2020 0
Using exceptions in Python looks easy but it is not. Probably you should study exceptions and exception handling before writing any Python code but TL;DR. There are examples on the internet, unfortunately most are very trivial. Anyway, I researched this and came up with some code I thought I share with you. Leave a comment if you have suggestions. What is an error and what is an exception, what is ...
29 May 2020 0
There are many types of vector icons. In this post I only look at SVG-icons, and limit myself to navigation icons, sometimes also called interface icons. These icons not only look nice on websites, they also color and scale like fonts. And they are very functional. Imagine a button with the text ' Edit' in it. Replace this text with a pencil-icon and you get more space on the page while it still is ...
12 May 2020 0
This site is running Flask. It uses DispatcherMiddleWare to run the frontend app and the admin app. The Flask documents state that the Flask applications in this case are entirely isolated from each other. That is true but often there is a lot of code we want to share between these apps. Things we want to share Both apps use the same database meaning we want to share the models.py file. Then we ...
Converting a SQLAlchemy MariaDb / MySQL database with Integer Primary Keys to UUID Primary Keys for a Flask website
26 April 2020 0
This website uses Flask, (plain) SQLAlchemy with Alembic for migrations and MariaDb. If you do not use these, this post probably is not what you are looking for. In a previous post I wrote why many websites should use UUID Primary Keys instead of Integer Primary Keys. Even if you have a high performance website then probably only few tables are responsible for this performance. High performance websites ...
16 April 2020 0
You have a website and it works fine. But you notice that certain visitors are trying to mess with your forms. They come from specific IP addresses. Then there are also bots that are scanning your site. Some are necessary but others should stay away. Don't you hate this? I do. In the past I once wrote a module that returned a not so nice response very slowly, byte-by-byte, slowing down their systems. ...
9 April 2020 0
We all know the Integer Autoincrement Primary Key. Works great, much software is doing it this way. It is fast. But it also has limitations. An alternative for the Integer Autoincrement Primary Key is the UUID (Universally Unique IDentifier) Primary Key. A UUID is a 128-bit number. It can be represented by a string, for example: 05390f2b-48e8-45c7-8ae4-08272dc69122 or a hex string (the same as above ...