Services
Blog
Français
Our designer Pavel Decrulle made a fantastic job at integrating mobile browser support in our website. A fantastic website to test it is Responsinator.
A great django app should have:
Usually, source code repository services come with an issue tracker. The most common are Github and Bitbucket for mercurial.
You can find other git hosts such as Baregit but they don’t necessarily include an issue tracker like Github or Bitbucket.
Most django apps use github, but also many of them are on bitbucket.
Read MoreAfter upgrading Ubuntu, I had to redo my custom dvorak layout.
To enable it, the only way I’ve found is to add the layout to /usr/share/X11/xkb/us.
Then you can enable it through a GUI, or with command:
setxkbmap us dvorak-intl-code
It is optimized for multilinguists and hackers:
// Dvorak international with dead keys and optimisations for code
// Olivier Mehani (shtrom-xorg@ssji.net) & James Pic
// Reproduce the per-key mapping of us(intl) for the dvorak layout
// aka "I just swapped my keys over"
// Symbols and numbers swapped for code
// colon and semi colon swapped for vim
partial alphanumeric_keys
xkb_symbols "dvorak-intl-code" {
name[Group1]= "English (Dvorak international with dead keys)";
include "us(dvorak)"
key <tlde> { [dead_grave, dead_tilde, grave, asciitilde ] };
key <ae01> { [ exclam, 1, exclamdown, onesuperior ] };
key <ae02> { [ at, 2, twosuperior, dead_doubleacute ] };
key <ae03> { [ numbersign, 3, threesuperior, dead_macron ] };
key <ae04> { [ dollar, 4, currency, sterling ] };
key <ae05> { [ percent, 5, EuroSign, dead_cedilla ] };
key <ae06> { [asciicircum, 6, onequarter, dead_circumflex ] };
key <ae07> { [ ampersand, 7, onehalf, dead_horn ] };
key <ae08> { [ asterisk, 8, threequarters, dead_ogonek ] };
key <ae09> { [ parenleft, 9, leftsinglequotemark, dead_breve ] };
key <ae10> { [ parenright, 0, rightsinglequotemark, dead_abovering ] };
key <ae11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] };
key <ae12> { [bracketright, braceright, guillemotright, rightdoublequotemark ] };
key <ad01> { [ apostrophe, quotedbl, dead_acute, dead_diaeresis ] };
key <ad02> { [ comma, less, ccedilla, Ccedilla ] };
key <ad03> { [ period, greater, dead_abovedot, dead_caron ] };
key <ad04> { [ p, P, odiaeresis, Odiaeresis ] };
key <ad05> { [ y, Y, udiaeresis, Udiaeresis ] };
// key <ad06> { [ f, F ] };
// key <ad07> { [ g, G ] };
key <ad08> { [ c, C, copyright, cent ] };
key <ad09> { [ r, R, registered, registered ] };
key <ad10> { [ l, L, oslash, Ooblique ] };
key <ad11> { [ slash, question, questiondown, dead_hook ] };
// key <ad12> { [ equal, plus, multiply, division ] };
key <ac01> { [ a, A, aacute, Aacute ] };
key <ac02> { [ o, O, oacute, Oacute ] };
key <ac03> { [ e, E, eacute, Eacute ] };
key <ac04> { [ u, U, uacute, Uacute ] };
key <ac05> { [ i, I, iacute, Iacute ] };
key <ac06> { [ d, D, eth, ETH ] };
// key <ac07> { [ h, H ] };
key <ac08> { [ t, T, thorn, THORN ] };
key <ac09> { [ n, N, ntilde, Ntilde ] };
key <ac10> { [ s, S, ssharp, section ] };
// key <ac11> { [ minus, underscore, yen, dead_belowdot ] };
key <ab01> { [ colon, semicolon, paragraph, degree ] };
key <ab02> { [ q, Q, adiaeresis, Adiaeresis ] };
// key <ab03> { [ j, J ] };
key <ab04> { [ k, K, oe, OE ] };
// key <ab05> { [ x, X ] };
// key <ab06> { [ b, B ] };
key <ab07> { [ m, M, mu, mu ] };
key <ab08> { [ w, W, aring, Aring ] };
// key <ab09> { [ v, V ] };
key <ab10> { [ z, Z, ae, AE ] };
key <bksl> { [ backslash, bar, notsign, brokenbar ] };
include "level3(ralt_switch)"
}; </bksl></ab10></ab09></ab08></ab07></ab06></ab05></ab04></ab03></ab02></ab01></ac11></ac10></ac09></ac08></ac07></ac06></ac05></ac04></ac03></ac02></ac01></ad12></ad11></ad10></ad09></ad08></ad07></ad06></ad05></ad04></ad03></ad02></ad01></ae12></ae11></ae10></ae09></ae08></ae07></ae06></ae05></ae04></ae03></ae02></ae01></tlde>
This article proposes a proven standard which enables automatic virtualenv activation.
Before, I had to do something like:
cd myproject
source ../env/bin/activateNow I just do:
cd myproject
Say I have a project called projectX, you could expect to find it as such on my servers:
/srv
/projectX_prod
/projectX_test
/projectX_dev
/projectX_dev_env -> the virtualenv
/env -> symlink to projectX_dev_env
/main -> the checkout of the python projectAs you can see, it is easy and consistent. For the record, this is the command I use to create the symlink:
Read MoreSchema migration consists of altering a database structure. For example, adding a column, an index …
When creating a Django model, running the syncdb command can create the tables. But syncdb doesn’t support schema migrations. So when modifying a Django model, reflecting the changes on to the database is left as an exercice for the sysadmin.
If you don’t speak fluent SQL, use the sqldiff command from django-extensions. It compares the database structure with the actual models for an app, and output SQL migration code. Installing the sqldiff command is really easy:
Read MoreThis post shows a coding standard which emerged from the Pinax community (formerly hot-club)[source needed] for predictive and consistent URL naming patterns. While this is still supported by Django, namespaced URL include() has been as well for some years now and urls should be translated when upgrading Django versions. Django Contributing Commons maintains a technical description which you can reuse in your project. Check it out and try to contribute, this could be a nice community driven git based coding standards for Django !
This article demystifies deployment of Python applications on any unix flavor. It’s distro agnostic approach is possible by a pragmatic use of each layer of a standard python application.
This article targets system administrators and why not python developers as well?
Compiling Python is blazingly easy and fast, particularly for veteran php system administrators !
First things first, to see the compile flags of an existing python installation, the “sysconfig” module can be used:
Read Moredjango-actream is a fresh and fantastic pluggable application for django. This article presents the solution to a simple performance issue: selecting followers and users who follow me through a generic foreign key … This article targets django users.
At the time this article is written, this is what it looks like:
class Follow(models.Model):
"""
Lets a user follow the activities of any specific actor
"""
user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
actor = generic.GenericForeignKey()
class Meta:
unique_together = ("user", "content_type", "object_id")The model has two relations:
Read MoreThis article presents a technique to get the return value of a form opened in a javascript popup, like Django admin for foreign keys. It can be used to improve the ergonomy relation select inputs.
When a form allows to create or edit data, many to one (n:1) relations choices are often presented in a select input. For example, Django admin uses a select field by default for foreign keys.
Read MoreThis article describes how to override a view from an external Django app which is a FAQ on StackOverflow and IRC.
You should understand that your urls.py is a really central and critical part of your django project.
You are not supposed to edit the code from an external app. Unless you fork it first on github.
If you want to override templates/userena/activate_fail.html, then all you have to do is create your own templates/userena directory and make your own activate_fail.html in it.