DevArt wins a Webby for Technical Achievement

Pretty proud to have worked on this project as technical lead and backend developer, DevArt wins a webby for “technical achievement”. As described by the organization:

This category is for any Site using new, innovative, Web technology in an outstanding way that improves the overall user experience.

here’s a link to the award

Back home after PyCon6

Back from #PyCon6 where I gave a talk called “Art & Music VS AppEngine”, where I showed how we implemented some performance enhancement tricks on GAE to make it work smoothly on content intensive projects we developed along with our fellows at Google Creative Lab London. Here the slides for the talk:

Also, I followed a few talks and took notes for future reference, here’s my recap (made with reveal.js and published here):

Thank you again to all the crew, you guys have been amazing: venue, food, schedule were absolutely spot on. Bring it on and looking forward to coming over for #PyCon7!

Spero di essere ancora così a 60 anni...

Bikes in the tunnel

Viaggiare soli per 3000km con il rumore del vento a 2cm dalle orecchie da molto tempo per pensare: si spazia dalle idee su come rifare la cucina all’eventualità di avere un secondo figlio, passando dalle ricette preferite per cucinare il coniglio e le possibilità per il prossimo lavoro.

Confesso che è piuttosto faticoso - sarà colpa del vento che agita tutti questi pensieri oltre a volerti strappare le braccia ancorate al manubrio - e sedersi su una panchina a fine giornata per bere una birra e osservare il tramonto sembra un’enorme ricompensa.

Ci sono momenti in cui ci si ferma anche durante il percorso ovviamente, e durante queste pause si tende a socializzare con individui che vengono riconosciuti come simili: stesso carapace, cavalcature equivalenti, dovranno per forza di cose essere consanguinei.

In due occasioni, entrambi forzate dal passaggio sotto al canale della manica, ho avuto modo di conoscere due distinte coppie di “miei simili” che, così a colpo d’occhio, avevano sulle braccia e nelle orecchie almeno venti anni di cavalcate più di me.

Mi hanno raccontato storie meravigliose e terrificanti, sempre col sorriso sulla faccia. La traversata del grand canyon a partire da Las Vegas, l’odore di ginepro sulla strada da Bilbao a Jerez, gli incidenti mortali visti sul Nurbungring e la paura di non trovare una stazione di servizio attraversando i Pirenei.

Mi hanno fatto tanta tenerezza e tanta invidia, e spero davvero che il vento continui a raccontarmi per lunghi anni avvenire le stesse cose che ha detto loro, perchè di sicuro ci vuole tanta passione e gioia di vivere per dimenticarsi di quanto, in realtà, voglia strappare le braccia da quel dannato manubrio…

How to fix Django, Apache VirtualHost, mod_wsgi and DJANGO_SETTINGS_MODULE

I've spent countless hours trying to fix Django installations running on legacy Apache servers, these usually recurring every few months, a time span long enough to forget how the last fix was done. And for some reason, the docs are not mentioning this crucial features AT ALL! In the official Django + mod_wsgi documentation page, they don't mention something so irrelevant such as THE MAIN DJANGO SETTINGS FILE?

For future memory, here's a solution that makes me happy, and hopefully next time will only be a few minutes headache (although I already know it won't be the case...)

- copy the default wsgi.py to a new file called apache_wsgi.py

- modify the new apache_wsgi.py so that it reads:

import os
import mod_wsgi
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings.%s" % mod_wsgi.process_group)

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

- now open your virtualhost configuration file and check it contains the following

WSGIScriptAlias / /path/to/your/apache_wsgi.py
WSGIDaemonProcess pick_settings_file_name processes=2 threads=15 python-path=/path/to/virtualenv/lib/python2.7/site-packages:/path/to/django/project
WSGIProcessGroup pick_settings_file_name

- almost there! create a /settings folder sibling of settings.py, put an empty __init__.py in it, then move settings.py inside that folder, rename it to common.py and create a new pick_settings_file_name.py with a single liner in it

from .common import *

VOILAAAAAAAAAAAAAAA!!!!

just restart your apache and everything will work. in your pick_settings_file_name.py you will have configurations specific for your environment (i.e. multiple copies of the file for dev, staging: project_dev.py, project_staging.py)

Time for my own AngularJS + Gulp + Browserify boilerplate

tl;dr: just visit my Github repo for a simple boilerplate with basic documentation.

I have found 36,749 examples of boilerplates using a miscellanea of AngularJS, Gulp, Browserify, Grunt, RequireJS and all the usual suspects.

But none of them actually did what I needed, although I reckon it is quite simple: define Angular modules in separate files, so the code is nice and clean and all the various services, directives and controllers are pluggable without massive headaches.

At the same time, having completely ignored the existence of Grunt so far (thanks to frontend guys who took care of this), I thought it was a good time for a fresh start with the latest and more fashionables Gulp and Browserify.

I ended up creating my own boilerplate (or seed, if you like), it works defining angular modules:

require('../../vendors/angular/angular');

module.exports = angular.module('boilerplate.controllers', []);

// Just define the list of controllers here while developing the whole app (in this boilerplate, just one):
require('./welcome.js');

using them:

require('../../vendors/angular/angular');

var module = require('./_module_init.js');

module.controller('WelcomeCtrl', ['$scope', function($scope) {
console.log('welcome controller');
$scope.greetings = 'Hey!'
}]);

and eventually compiling them in a single js

gulp.task('scripts', function() {
  return gulp.src('scripts/main/app.js')
    .pipe(browserify({
      insertGlobals : true,
      debug : !isProduction
    }))
    .pipe(gulp.dest('build'))
  });

if anyone is interested, feel free to clone and submit pull requests!