Djangocon lightning talks day 2

Tags: django, djangocon

Sorry if I mangled any of the names, that’s the hardest part of blogging lightning talks. Many don’t show their name long enough :-)

Single page web apps with django and extjs - Michał Karzyński

Single page apps: you’re writing two apps. A front end one and a back end. The routing is done on the client side. The back end just spits out data (JSON api).

ExtJS has a store that handles communication with the backend. So that talks to your JSON API. Plan that API carefully, try to keep it nicely RESTful.

He showed a one minute demo. There is a longer one on his blog.

Don’t trust, check - Marcin Mincer & Tomek Kopczuk

Check and question everything. Seek the best way. Not all good solutions are as good as they seem. They compared a standard view with a tastypie view and the regular view was much faster.

They also checked, for their example, whether using jinja2 would be faster than django templates. Yes, it is faster. Despite what the two scoops book says.

So: check everything for your usecase.

Lessons learned - Tom Christie

Tom maintains the Django rest framework project. He tells us a few lessons he learned.

Be negative

Everything someone submits to a project increases the maintenance burden for the maintainer. So suggest things that can be removed. Before submitting a bug, first fix an easy one.

It is your fault

You haven’t yet stepped in and contributed what you want.

Forget about DRY

Simplicity is a design goal, DRY only follows from it

Link everything

Don’t make me search, just provide a direct link

A deprecation policy makes change easier

Figuring out a formal deprecation policy actually makes making changes easier.

There’s no such thing as a core dev

All of us have what we need to know to be a core developer. They only have the extra commit bit to actually commit the change, but almost everyone can do the work.

Community and learning - Karol Majta

Karol is a mechanical engineer that has some python knowledge. He’s new to Django and provides some community feedback from that background.

If you’re new to Django, you’re new. You need experience. You need to learn. But because you don’t know much, it is easy to learn more! And… the community is great at helping you learn. Positive feedback!

Two phase commit - Grzegorz Nosek

Two phase commit is a quite unknown database feature. Everyone knows database transactions.

In SQL it is somethign like PREPARE TRANSACTION 'foo' before a bigger set of changes, COMMIT PREPARED 'foo' afterwards.

This two phase commit is not only for databases, you could also use it in regular python code, for instance when creating files.

Django-downloadview - Benoît Bryon

You manage files with django, for instance for authentication, permissions. FileFields or ImageFields, but it can be also local files, remote URLs or generated files.

django-downloadview provides class based views for almost every usecase. You can also extend and modify those views for your own use cases.

Django is not efficient for streaming files, so you need x-sendfile (apache, lighthttpd) or x-accel (nginx). There’s a middleware for that!

(Personal note: investigate that one; looks very useful).

PHP-like django - Markus Tomqvist

DHP is PHP in django :-) You’ve got a {% code %} template tag that you can write your django code in. Totally dirty and he’s never going to finish the project.

It works by calling eval() on the extracted code and by copy/pasting some django wsgi stuff.

Everyone was laughing.

Django pony checkup - Erik Romijn

Last year he spoke about making secure websites.

Lots of those things are remote-checkable. So he wrote the django pony checkup website which you can pass the URL of a site.

He actually ran it on 3707 django websites. The score is not good.

  • 7% runs in debugmode.

  • 97% has no clickjacking protection.

  • 83% has no HTTPOnly session.

Run http://ponycheckup.com/ on your sites!

What is new in Django CMS - Benjamin Wohlwend

The new release isn’t out yet; he already shows what’s new.

The 2011 version had front-end-editing, but it has some problems which they aim to fix in the new version.

The 3.0 goals:

  • Make it beautiful.

  • Keep the end user out of the /admin.

  • We don’t want to interfere with your markup.

  • Front end editing suitable for experimenting and playing with it. It should be safe.

  • It should be fun.

He showed a demo. Sure looks polished and nice.

L20n, localization 2.0

There’s content localization (whicn l20n does not do), l20n does UI localization.

Gettext is the one used now. It is English-centric. It has limited plural-handling, for instance. All those countries have different rules. English just has single/plural, many languages have 1, 2 3/4, 5+, for instance.

There’s a lot that needs fixing. L20N attempts to fix it.

He showed a couple of examples. Wow it sure is work for many languages. But it seemed to work quite well.

See http://l20n.org/

django-mail-factory - Rémy Hubscher

Mails with django: you need html and plain text emails, attachments, etc. Then you need to check whether the mails are coming out OK. So you mail it and someone has to look at it.

What we want? Preview html and plain text emails, possibly send one as a test. And good warnings about missing context variables.

You can register all your different emails at django-mail-factory and define the context variables that they need.

See https://pypi.python.org/pypi/django-mail-factory

Spreading Django - Markus Zapke-Gründemann

How can more people learn Django? You could give tutorials, give talks, hold workshops. For this you need someone to do it.

He prepared http://django-introduction.keimlink.de, which gives a nice introduction. This needs an English translation.

http://django-marcador.keimlink.de provides a tutorial. This one is already multilingual.

He wants to use transifex for the translations later on.

Translating models - Jef Geskens

Jef makes websites in Belgium. That is a problem. They need at least 3 versions: French, English and Dutch. So that also means translating text inside models. Some of those models are their own models, but a lot is in existing external apps and he doesn’t want to modify them.

He started django-datatrans that can handle all that without changing anything to the underlying models.

Python deployer - Jonathan Slenders

They originally used Fabric, but they missed some features. So they started python-deployer.

He showed a demo.

Setting up your django project in 60 seconds

You want to get up and running as quick as possible. There are lots of things, though, that you need to do every time.

Take the time to put those initial steps in some sort of ready-made skeleton for new projects. Initial settings, especially if you split them up in separate files. Initial empty south migration. Fabfile, makefile, things like that.

 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):