djangoconferencecommunitypython

DjangoCon 2018: The first two days

4 min read

DjangoCon 2018: The first two days

--

Last Tuesday (24 may 2018) afternoon we traveled to Heidelberg in Germany for DjangoCon Europe 2018. As mentioned in our earlier blog post, DjangoCon is a conference for anyone interested in Django. It is a combination of talks (technical and career & craft related) and socialising with the other Django users/developers.

There are three days of talks and after that 2 days of sprints. The complete schedule is available at https://2018.djangocontent.eu/hd/schedule/. All talks are also available at YouTube.

Below some highlights about talks we’ve followed. More to come tomorrow and during the sprint this weekend!

Django Channels 2.0

There were two talks about Django Channels, a project which adds asynchronous (async) functionality to the Django framework.

Regular code (synchronous also called sync) will execute code sequentially. This means that when for example your code needs to retrieve data from a database server it blocks further execution until the the data is returned and it can be processed. In other words your CPU isn’t doing anything productive but just waiting on IO (Input/Output).

A solution which is used a lot is to handle a HTTP request in a separate thread (multithreading). This is a bit ‘brute-force’ since it’s actually like running multiple applications on the server. Even if you run a lot of threads there is still a big change that each thread is waiting on an external service like a database.

This is where async code comes around. The basic principle of async code is that there is an event loop which schedules blocks of code. Every-time one part of your code is doing an IO operation (database call) it will halt that part of code and start running some other code for which there is data available.

There is of course a downside of async code, it is generally more complex to understand/write and you can’t easily mix sync and async code. The latter is the focus of the Channels project. The first talk by Iacopo Spalletti showed an example project and the steps he took to implement it. It also covered potential pitfalls. Andrew Godwin, the author of Channels, presented an overview of the history of the project and the reason why Channels 2.0 was a complete refactor.

GDPR

One day prior to the enforcement of GDPR, naturally this was a topic during DjangoCon. Will Hardy explained to us what it entails, what Django already does for you and a couple of best-practises that you can implement.

To start, Will explained that as professionals in the software engineering space, the GDPR is an important topic that you should be on top of. Basically they are rules that you should implement from the start and by design.

For example, implementing proper encryption at the user level, with per-user encryption keys, to make sure that sensitive data will not end up on an analysts’ computer in plain text.

Also, users may request data to be removed (Right to Erasure, article 17). And that also includes removing users’ data from back-ups. So with individual user encryption keys, simply throwing away the key will fulfil this requirement, because then there is no way to retrieve that encrypted information anymore.

We are currently working hard on several GDPR projects for both ourselves and our clients, and expect to publish more updates about the topic soon!

Automated spell checking

Another interesting talk was by Jakob Schnell about integrating automated spell checking of translation files in the CI/CD pipeline. Translations in projects are almost always done by using the gettext library. Jakob developed an application called potypo which extracts the translated strings from the translation files (.po) and runs it through pyenchant. This is definately something that we at Lab Digital will be following closing as it can result in higher quality software.

Tags used in this article:
djangoconferencecommunitypython