Confessions of a Django Under The Hood Attendee
Django Under The Hood Conference
Django is the main web application framework used by 10Clouds developers so just like last year, some of the 10Clouds team attended the Django Under the Hood Conference. To provide readers with an insider perspective to the conference, we asked our developer to share her thoughts and opinions about the event. This year’s conference, held in Amsterdam earlier this month, consisted of nine talks and two workshops. For anyone interested, videos of the presentations can be found here. One of the greatest aspects about this conference were the talks. What made them special was the fact that they were authentic because they were given by the developers that actually, wrote the codes they were speaking about. One of my favorites was on Django expressions, which was given by Josh Smeaton – a Django core developer and the primary author of Expressions in Django. A copy of the slides used during his talk can be found here.
Highlights from “Django Expressions”
To avoid spoiling all of the fun, I will only mention a few highlights from the talk that I personally, found to be great. Also – if interested in viewing reference material that coincide with the key points I will be mentioning, take a look at: Django documentation for what I’m going to show is available here. A nice recap of the documentation on F() and Func() can be found here.
- F() expressions
Using F() we can perform database operations on model fields without the need to pull them from the database into Python memory. It’s now possible to combine them with other elements like shown below:
2. Func() expressions We can use Func() with one of the database functions to have some work done on the database side instead of in Django:
or if we’re going to need this function a lot we can do:
More db functions can be found here. However, we’re not limited to the short list of functions found under the docs above; using Func() we can access some powerful functions offered by PostgreSQL (More about postgres functions can be found here. An example:
We can also create more complicated functions using Func:
and use it like this:
3. Conditional statements Case When – which lets us perform if … elif … else in an ORM query Here’s an example from the Django documentation:
As a developer, I will explain why this talk was extremely beneficial. Using Django expressions can save developers a lot of time. This is because a lot of the work that would normally be done in Python, can be handled by the database, which eliminates the need to use extra() or .raw() so the code is left nice and clean.
A Great Tool for Application Development
In additional to learning new tips for enhancing my programming skills, I walked away with a list of valuable resources. A useful tool that stood out to me and that I would like to share information about is Opbeat, which is an application monitoring system for developers. To visit the official webpage for this tool, visit: https://opbeat.com/. To explain a bit about the tool, Opbeat is divided into three main sections: releases, errors, and performance.
In the first section we’re able to track our application’s releases, which is pretty straight forward and can definitely come in handy (here’s a simple example for how to set up release tracking using Ansible.
If you are familiar with Sentry, which is another application monitoring solution, the error section of Opbeat is kind of similar – with the notifications, error grouping, resolutions and stack traces (screens of Opbeat are taken from their website).
Opbeat also has a feature that allows for the integration of Github so it will show who is responsible for each line of code. It also allows for you to assign errors to specific members of your team, which is extremely helpful for error management.
In the performance section, there are graphs showing response times and requests per minute as well as a list of influenced views, which can be sorted by various criteria, such as impact.
As you select items from the list, you will see a detailed breakdown with SQL queries, code sections and information regarding the person that submitted the code and when. Each part of the breakdown includes details on it’s impact on the view call time.
In conclusion, attending the DUTH conference was a great experience – I enjoyed learning about what happens behind the scenes of the different areas in Django. Furthermore, the social aspect of the conference was amazing. Did I mention there was a boat party :D?. The atmosphere was really warm and people were very welcoming. I was also able to receive answers to a lot of questions that interested me. All in all, I cannot wait to attend the conference next year!
I attached some photos below to show!
Our 10Clouds Team Representatives! (and me in the middle)