If like me, you have difficulties to find a clear guide on how to create a Docker image in an app whose dependencies are managed via Poetry, this article is for you.

The goals are:

Many devs discovering Flask.

I started the draft of this post a few years ago (2016) and I’m published it now because to my surprise it still relevant in 2021!

I used to code my server-side Web applications with Django. I often verified the Django’ motto « The web framework for perfectionists with deadlines…

This method of deployment is convenient if you have a non wildcard SSL certificate for your domain. This way, you can add another application to your domain in a new directory (eg. example.com/foo/).

The first step is to set up nginx to pass SCRIPT_NAME to your app:

location /foo/ {
include uwsgi_params;
uwsgi_param SCRIPT_NAME /foo;
uwsgi_modifier1 30;
uwsgi_pass unix:/run/uwsgi/app/foo/socket;
}

In your Django application, you must always use the URL resolver to generate URLs (reverse()), if you really want to hack your URLs you can use get_script_prefix() with something like that:

from django.core.urlresolvers import get_script_prefixscript_prefix = get_script_prefix()

The last step is to define STATIC_URL to ‘/foo/static/’ (and MEDIA_URL if used).

Note: admin URLs use the ‘admin’ namespace so for example, you can do resolve(‘admin:index’) to resolve as ‘/foo/admin/’.

Lorsque je devais lier un modèle à une liste de valeurs en SQL, j’avais pris l’habitude d’utiliser une relation de ce type:

Without ArrayField

Lorsque la liste est fixe (ou a minima non modifiée par l’utilisateur), il n’y a pas d’intérêt à disposer d’un modèle distinct. Ce type de relation…

If LVM2 shows some warnings like “Incorrect metadata area header checksum”, it’s certainly because it checks some partitions without LVM support (x8e). The filesystem works fine with this message but you can get rid of it, exclude not LVM partitions by editing /etc/lvm/lvm.conf :

filter = [ “r|/dev/cdrom|”, “r|/dev/hda1|”, “r|/dev/hda3|” ]

Use fdisk to know the partitions to exclude and run vgscan to test.

Originally published at sralab.com on December 6, 2005.

At home or at work, you probably have spotlights which indicate only 20W or 35W of power consumption, but sadly these spotlights are powered by a lower voltage and so they require a transformer (hidden in the ceiling, a cupboard or a hood) which in turn consumes around 40W.

I’ve recently designed an application (with libmodbus, glib and Django) to measure the power consumption from various sensors built by LEM. By doing some tests at home, I’ve confirmed my suspicions about a transformer permanently plugged into the mains (0.18 * 224 = 40.3W for total of 80W when both spotlights are turned on).

So, I’ve replaced the shunt plug with a switch between the main and the transformer and once again I have a perfect 0W when off!

Do you know how many electricity transformers do you have around you?

Originally published at sralab.com on October 13, 2010.

It’s strangely hard to find documentation on the git workflow to follow to keep a clean commit history when you want to merge external contributions.

First enable rebasing by default

As it’s written on live.gnome.org, many users find that they happen to do “git pull —rebase” most of the time…

Bravo aux organisateurs de la première édition des rencontres Django FR, qui avaient même prévu des activités pour les accompagnateurs (conjoints, conjointes et enfants). Le planning des conférences a été fidèlement respecté malgré les aléas de la restauration.

L’ambiance était chaleureuse et l’évènement idéal pour rencontrer et discuter avec les djangonautes français (dont un belge du projet GNOME).

Ma présentation sur l’i18n/l10n avec Django et les photos de l’évènement par Providenz.

Originally published at sralab.com on April 27, 2010.

Les produits que l’on nous persuade d’acheter son souvent excessivement techniques, pour des avantages peu probables et une fragilité bien réelle. Qu’il est compliqué de choisir parmi la pléthore d’appellations brevetées, j’apprécie les produits simples et bien conçus, qui vont remplir leur tâche de longues années sans montrer de signes…

Dorénavant, vous ne lirez plus la question suivante en ligne de commande :

rm: détruire fichier régulier `toto.c’?

mais

rm : supprimer fichier « toto.c » ?

bien que la seconde forme ne soit pas parfaite (limitation interne), elle est d’une des améliorations qui résulte d’un long travail de relecture…

Stéphane Raimbault

I like clean and open code (Django, JS, Rust, libmodbus). http://webstack.fr

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store