Navigating the maze of Django's URL routing: a deep dive
06-07, 16:10–16:40 (Europe/Madrid), Auditorium

Grab your SCUBA gear - it's time for a deep dive!! Building from the ground up, we'll re-implement Django's URL routing machinery and learn about best practices, bugs, and URL design along the way.


How exactly does Django match a path to a view? What does good URL design look like? and why should you care about it? How can your URL schema even affect things like security and performance?

Starting with a basic pattern matcher that we could use with Django to route paths to views, we'll incrementally add features and enhancements until we have a fully-fledged URL-routing system similar to the one that Django ships with. As we add match objects, path converters, reverse functions, internationalisation features, URL resolvers and more, we'll think about why things have been implemented the way they have been, and how we should best utilise them to avoid bugs and keep our URLs clean.

As we build the router, we will occasionally step back from the intricate implementation details to consider the fundamental principles of effective URL design that guide its development.

This talk is aimed at intermediate users. Nonetheless, it may well be of interest to the newer Django developer as well. The approach is based on the philosophy that having a deeper understanding of the implementation of something equips you with the ability to better recognize its nuances, which in turn enhances your proficiency in using it. I also hope that this talk will provide the confidence to start exploring more of Django’s internals if that’s not something you’ve done already.

Video: https://youtu.be/lQuM8HDCdM4


Topics

Django Internals, General Python

Audience Level

Intermediate

Maths teacher turned programmer. Timothy McCurrach has been writing Django at YunoJuno for the past 4 years. Though a long-time Django aficionado, he also enjoys dabbling in React and any other technologies that catch his eye. When not at his laptop he can usually be found at his local climbing gym or out exploring the Kent countryside.