Tag: development

Say hello to Loqu4cius

loqu4cius

Loqu4cius is a lightweight blog engine based on Django (not this Django), that runs on google app engine and it uses as backend CloudSQL, which is, as google put it, MySQL on the cloud.

A bit of history

Google appengine has the ability to run scalable app. So far it was possible to use django on it, given the fact Python was one of the two supported languages, however the back end was big table, which is not compatible with the classic RDBMS used by django.

This made impossible to use span relation and over, so the only usable bit of django were the templates, the URLs router but not the model…

Django-nonrel to the rescue.

A project called django-nonrel came to the rescue, and it created a compability layer between the NoSQL backend and the classic django ORM. Most of the span relationship were working, however some of the join, like the many2many were not available.

Fast forward to our time

Fast forward to today, google made it possible to have a classic RDBMS available, with the possibility to use all the ORM goodies, included django third app that can speed up and reuse the development.

So now Google-cloud to the rescue.

To check it out, I’ve came up with Loqu4cius.

It features a tag cloud that makes it be 2.0, is based on Twitter Bootstrap, and I’ve styled with some colors and the fonts (directly from google font), a search bar and the ability to enter rich text using ckeditor. The comments are integrated using disqus, that is the way to go right now.

The code is on GitHub with a quick readme, for any question the comments are here :).

Some thoughts about the development

Google appengine comes with some limitation, but with the possibility to add third parties libraries it is possible to re-use a lot of the django apps already available. (Let’s agree on terminology: app –> a single application that does one thing, for example it manages the tags, project –> a collection of all the apps and related files that runs the entire site.)

My strategy is to create a virtualenv and than copy all the necessary modules into the lib folder. This gives me the ability to install a package with

pip install package_name

and all the dependencies very easily. After that it’s a matter or using the apps and make it work pretty nice.

CSS writing

I like to use less to write CSS, but I don’t want to have a client compilation of the less file, and I want only to serve CSS in production, therefore I use two helper to get the job done.

First I use a python script that finds all the less file and compiles them into css, calling the lessc compiler.

However I don’t want everytime that I write a new bit of the less file, to call the script myself, so I use watchdog to call the script everytime the less file gets saved.

It would be nice to have a tool that can launch both the development server and this script in one go, and it actually doable. It’s called honcho and it accepts a classic Procfile.

For example for loqu4cius this is the Procfile.Dev

web: ./serve.sh
less: watchmedo shell-command --patterns="*.less" --command='./scripts/build_less.py "${watch_src_path}" ' static/less/

launching it with honcho -f Procfile.dev start makes sure to launch the development server, and to recompile and move the file to the collectstatic folder as required in one go, so you can focus on just developing.

Last but not least, I’ve created a quick release script, called release_site.py, which:

  • increases the app.yaml version of the site
  • performs the syncdb in production
  • uploads the site using appcfg.py,
  • commit the modifies app.yaml to the repo
  • tags the repo with the version number

so you can always now which commit refers to which version on googleappengine.

To figure out how to set up the enviroment in a way to have a streamlined development took me a bunch of days, and I’m eager to know other solutions to the same problems!

Neuronvisio 0.8.0 out in the wild

pyramidal_3D_change_voltage

A Pyramidal Neuron model visualized with Neuronvisio

We have just released a new version of Neuronvisio, which depends on Mayavi 4.1.x. All the goodies are described in the docs, but I want to highlight an aspect of this release which is pretty important.

When we have ported Neuronvisio, from Mayavi 3.4 to Mayavi 4.1.0, two regression bugs popped out: Issues #32 and Issue #34 .

The good thing about issue #34 was that it was gone in the 4.1.1.dev version of traitsui, therefore we had just to depend on the development snapshot, however the story was different for #32. The bug was difficult to replicate, and it seems to not be deterministic. After investigating the problem, I’ve managed to isolate and set up a Pull Request which actually fixes it https://github.com/enthought/mayavi/pull/23.

While the Pull Request was still to be accepted in the main tree of Mayavi, we wanted to distribute it out there, because Neuronvisio paper is under reviewing, and the Reviewers had several trouble to install the version 0.7.3, which depends on Mayavi 3.4. We managed to package both traitsui and Mayavi and make them as required dependencies of the new Neuronvisio, and using the special version requirement in the pavement, we could make the installation as automatic as possible.

All in all, to install the latest version of Neuronvisio, depending on the latest version of Traitsui and the patched version of Mayavi 4.1.1.dev a user has to run

pip install -U --extra-index-url=http://www.ebi.ac.uk/~mattioni/snapshots/ neuronvisio

which I think it’s pretty neat.

With the new version out, we didn’t want to remove the old docs, ’cause the version are quite different and same information applying to one version in particular. Some of our user may don’t want to update to the latest version, so we have now Neuronvisio docs hosted to the beautiful Read The Docs, at http://readthedocs.org/projects/neuronvisio/ where you can choose the docs according to the version.