DjangoCon 2022 Porto! Part 2
Previous years were complicated due to the COVID-19 pandemic, so many conferences were held just online during those hard times. Fortunately, me and my friend Marek had the opportunity to attend DjangoCon 2022. DjangoCon was held in Portugal, so that was another motivation, for both of us, to visit this beautiful country since we were studying there. With this blog, we would like to briefly point out the lectures/information that interested us the most.
In 2022, after years of the pandemic, my friend David and I were thrilled to return to Portugal, a country where we had spent our student exchanges. This time we came for DjangoCon EU 2022 in Porto, Portugal, and I must say, it was quite the experience. From the lively discussions and informative talks to the inspiring keynotes and fun-filled social events, this conference had it all.
Day 2.
Since David already wrote part 1 about the first day, I will continue with day 2. The second day was very interesting, here are few presentations that stood out to me:
Will PyScript replace Django? - What PyScript is and is not (Cheuk Ting Ho)
Running Python code in HTML? Very easily with PyScript, just look a it:
<html>
...
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
...
<py-script> print('Now you can!') </py-script>
</html>
Cheuk Ting Ho gave us an interesting presentation about this new framework. It's not aiming to replace Javascript, but rather be used with it. It provides an easy way to run Python code in browser, but it's definitely not a replacement for Django, since it is a frontend-only Python. But there may be a cases where it comes handy.
Video from presentation: https://youtu.be/tzRRImsez88
Observe! (Honza Král)
Observability of the code is very important, especially in production environment. How can we ensure it's both user-friendly and straightforward to debug when encountering problems or bugs? This was the point of Honza Král's insightful talk. He delved into a various tools to achieve robust observability, touching on crucial aspects like uptime monitoring, and introduced an impressive package known as structlog (a highly recommended resource to explore). Additionally, he highlighted the significance of metrics and application performance monitoring, utilizing the powerful Elastic stack.
Video from presentation: https://youtu.be/vD04YcGr6LU
From React to htmx on a real-world SaaS product: we did it, and it's awesome! (David Guillot)
htmx is another new library that is starting to gain more attention. It allows you to access modern browser features (like AJAX, CSS Transitions, WebSockets and Server Sent Events) directly from HTML, rather than using javascript. David Guillot and his team decided to migrate their real-life React project to simple Django templates and htmx. David talked about the challenges of the migration process, differences and the impact on team, UI and end users. He concluded what it was worth to do it for them.
Video from presentation: https://youtu.be/3GObi93tjZI
Packages worth checking out
Here are some of the interesting Python packages or tools mentioned during DjangoCon:
- ScanAPI - Nice library that provides Automated Integration Testing and Automated Live Documentation for your API. You just need to write simple specification of the API in YAML or JSON format.
- orjson - JSON library which claims to be the fastest Python library for JSON! And it's not just about performance boost, it also serializes dataclass, datetime, numpy, and UUID instances natively.
- django-components - This package provides an easy way to create simple reusable template components in Django.
- django-auto-prefetch - Optimizing queries to database by using
prefetch_related
is really good way to speed up response times, but do you always think of it? For example, when iterating a queryset and accessingForeignKey
orOneToOneField
. This little package will automatically prefetch foreign key values as needed. Very nice! - django-minify-html - Extremely fast HTML + JS + CSS minifier you can use with your Django project.
- mypy - Optional static type checker for Python that combines convenience of Python with type system and compile-time type checking.