This Old Pony: Working With Legacy Django Apps
summary
Defines legacy as code in production often lacking tests and clarity and recommends concrete steps: do a disciplined code review with flake8 and PyCharm, add logging before tests (Sentry for stack traces), write bug-reproducing and smoke tests, silence flaky tests, speed slow suites, and use tox to test multiple Django versions aiming for an LTS. Handle dependency breakage by patch and PR or vendoring forks, run Bandit for secrets, and incrementally refactor big apps (move models with Meta db_table, push view logic into managers).
AI-written summary · about
chapters (40)
- 0:00Start
- 0:42Legacy software?
- 1:11What is "legacy"?
- 1:24Code someone else wrote
- 1:47Code that has no tests
- 2:12Software that's in production
- 2:42Written software is an investment
- 2:59Ugly, old systems deliver value
- 3:16The world runs on legacy software
- 3:27What is legacy Django?
- 4:31Some assumptions
- 5:08Goal: improve code in discrete steps
- 6:57Step 0: Ask questions
- 7:11What's it supposed to do? What does it do? Known bugs? Planned features?
- 7:34Reading the code
- 7:45Confusing areas Architecture Code smell Style &c.
- 9:35Understand production errors
- 11:14Fix bugs Guide development Deployment confidence
- 11:36Tests provide information about code quality.
- 11:49Test suite scenarios
- 15:30Prioritizing new tests
- 16:01Smoke tests View-centric integration tests
- 16:42Refactoring
- 17:13Backwards incompatibilities
- 17:32Superpower: tox
- 19:18Tight integration with obsolete libraries
- 19:45Version support mismatches
- 20:14Upgrade!
- 20:29Patch and pray (upstream)
- 21:32Extract what you used
- 22:02Remove/replace
- 22:48Formatting
- 23:33Settings
- 24:20One big app
- 24:31Solution: Break up apps
- 25:01Big views (lots o' logic)
- 25:19Fat models
- 25:40Expansive forms
- 26:24New feature? New app!
- 26:34What didn't we talk about?
related talks
42mManaging technical debt in (Django) Projects
21mBuilding maintainable Django projects: the difficult teenage years
53mDjango productivity tips and tricks
24mStumbling Through Django and How Not To
01h 06mEffective Django
32mContinuous Deployment and Release of Django Apps
53mDjango productivity tips and tricks
29mScaling Django to 500 apps
