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 a aussi l’inconvénient de nécessiter l’utilisation d’un prefetch_related() lors de l’affichage des modèles auxquels ils sont liés (Issue dans notre cas).

Heureusement, Django 1.8 expose un nouveau champ de base de données spécifique à PostgreSQL[1] nommé ArrayField qui permet d’utiliser les arrays. Le code précédent peut alors s’écrire :

With…

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.

About

Stéphane Raimbault

Développeur Open Source pour le Web et l’embarqué (Django, JS, 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