PyCon DE & PyData 2025

Django's Dilemma: Balancing Simplicity with Scalability
2025-04-23 , Palladium

Django's model-view-serializer approach works great for small apps, but as projects grow, you might face challenges like scattered database operations and APIs that are too closely linked to your database models. These issues can make unit testing and scaling harder. I'll share real-world examples of these problems and show how to refactor an app using ideas from Domain-Driven Design (DDD) and hexagonal architecture. We'll look at a before-and-after example to see how these changes can make your app easier to use and debug. Plus, we'll discuss when Django's simplicity is enough and when it's worth adopting a more structured approach. You'll leave with practical tips for transforming your Django projects into systems that can handle increased complexity.


Is your Django application starting to feel like a house of cards? You know that feeling - where adding a simple feature requires touching five different files, where test coverage is dropping because mocking becomes a nightmare, and where new team members need weeks to understand the codebase? You're not alone.

Django's model-view-serializer pattern is brilliant for getting projects off the ground quickly. But as your application grows, you might find yourself fighting against the very conventions that initially made Django so productive. Whether it's a webhook system that needs to support multiple client formats, a payment processing service that keeps accumulating edge cases, or an e-commerce platform that's becoming increasingly complex - the traditional Django patterns start showing their limits.

In this practical, code-focused session, we'll tackle these challenges head-on. Using a real-world webhook server as our guide, we'll explore how seemingly simple requirements like "let each client customize their response format" can lead to a maze of if-statements and technical debt. You'll see actual code examples of how these problems manifest and, more importantly, how to solve them.
But this isn't just another talk about theoretical patterns. We'll dive deep into:
How to identify the early warning signs that your Django application needs restructuring
Practical techniques to refactor your code without breaking existing functionality
Real-world examples of applying Domain-Driven Design principles to Django applications
Step-by-step implementation of a hexagonal architecture that makes your code more testable and maintainable

Concrete patterns for separating business logic from Django's framework code

You'll leave this session with:
Ready-to-use code patterns for common scaling challenges
A clear understanding of when and how to implement more sophisticated architectural patterns
Practical strategies for refactoring existing Django applications
Techniques for writing more testable and maintainable code
Confidence in handling complex business requirements while keeping your codebase clean
Whether you're dealing with a growing Django application that's becoming harder to maintain, or you want to prepare your codebase for future scaling challenges, this session will give you actionable insights and practical solutions. Come with your challenges, leave with a toolbox of battle-tested patterns.

Perfect for developers who are comfortable with Django basics and want to level up their architectural skills. This will be a code-heavy session with real-world examples you can apply to your projects immediately.


Expected audience expertise: Domain:

Novice

Expected audience expertise: Python:

Intermediate

As a seasoned Software Engineer with a strong focus on backend development, Anette is thriving at the intersection of product innovation and scalable architecture.

Currently at Qonto, a leading FinTech unicorn, she engages deeply in feature development, scaling initiatives, and architectural improvements using an advanced tech stack including Golang, Ruby on Rails, and Python, complemented by distributed systems expertise with Kafka, AWS, Docker, and Terraform.