Weird test behavior in my Django project test suite after an IntegrityError

Posted on 2024-12-01 in Programmation • Tagged with Python, Web, Django

Recently I encountered a very weird behavior in my Django project test suite. I created a view that caught an IntegrityError from the database (caused by duplicates in a unique index). When this error occurs, I want to respond with a 409 - CONFLICT status code and an error message.

TL …


Continue reading

Django async

Posted on 2023-12-10 in Programmation • Tagged with Web, Django, Python

Now that Django is fully async (views, middleware and ORM), I though it was a good time to test how it behaves when run asynchronously. I’ll try to keep this article concise with only relevant data and resources. Code can be seen in a sample project so you can …


Continue reading

Writing RSS reading app with various frontend frameworks

Posted on 2023-09-09 in Programmation • Tagged with Web, Javascript, Typescript, React, Angular, Svelte, Vue

During the summer, I decided to test a few frontend framework to see what’s going on in this space and form a better opinions over alternatives to React. I tested Svelte because after hearing from it I felt attracted to it, Vue because it is popular, React to have …


Continue reading

Make JS code communicate with a ServiceWorker

Posted on 2020-08-18 in Programmation • Tagged with JavaScript, Web, ServiceWorker

If you need to send data from your JS code to your ServiceWorker, you can do it like this:

navigator.serviceWorker.register("./sw.js").then(registration => {
    registration.active.postMessage("Some message");
});

You can then rely on this code in the ServiceWorker to read the message:

self.addEventListener("message", event => {
    console …

Continue reading

Should you build a SPA?

Posted on 2020-06-15 in Programmation • Tagged with JavaScript, Web, Django

This article is an update to a previous article why you want to build a SPA which I think was laking some nuance and precision. Reading this article is not required to read this one. I'm writing this update because SPAs are very popular and I recently though more about …


Continue reading

Why you probably want to make a SPA

Posted on 2020-01-12 in Programmation • Tagged with JavaScript, Web, Django

Important

I created an updated version of this article in should you build a SPA which provides a more complete and balanced view on this subject. Please read it instead of this current article.

I am currently working professionally on a website that is not a SPA. I'd like to …


Continue reading

Some tips for django

Posted on 2018-05-21 in Trucs et astuces • Tagged with Python, Web, Django


Continue reading