How to Upgrade to the Newest Shiniest Django Version

Susan Tan
Susan TanSoftware Engineer. Ballet dancer and ballet patron. Tea drinker.
How to upgrade to the
newest shiniest Django
version
DjangoCon Europe
Susan tan
Cisco in san francisco, CA
1
Hello! I’m Susan
• I’m a software engineer at Cisco in San Francisco,
CA.
• Previously worked at a cloud startup Piston.
• Works with python apis, web development, works
on Cisco’s openstack horizon Django project
• Worked on open source Django project
www.openhatch.org
2
Quick Audience Survey
How many people currently work on at least
one project with Django
• below 1.6?
• 1.7?
• 1.8?
• 1.9?
3
Why should you do an upgrade?
• get new features, bug fixes,
security fixes
• easier to upgrade to the next
version in future
4
A.B.C


backwards-incompatible
new features
backwards compatible
backwards-compatible bug
fixes.
Semantic versioning review
major minor patch
Read http://semver.org/
5
Django does NOT follow semantic
versioning FYI
6
• Major release number is an extension of minor
release number.
• From semantic versioning, Django 1.7 should be
2.0, because backwards-incompatible.
When is right time to upgrade?
• Your project’s Django version is no longer
supported.
• Do a patch upgrade! Always.
• You have an existing comprehensive test
suite.
• If you don’t have a test suite, then now would be a
good time to start writing unit tests.
7
8
Current Django Versions
Source: https://www.djangoproject.com/download/
9
Future Roadmap
Source: https://www.djangoproject.com/download/
[3] Last version to support Python 2.7.
• Hard to know how much time or effort it takes
• Hard to know which tests will break or even run
• Hard to know if UI will continue working
• Confirm functionality at every part of
development
• ie: local host, staging, deployment.
10
Why is upgrading a Django project a
difficult thing to do?
What does the end product look
like in code?
11
12
Upgrading OpenHatch
Upgrading OpenHatch
13
• OpenHatch vendors all its dependencies.
• Commits that are "Add upgraded version of
library Z” with full library source code.
• ~4 weeks to go from broken Django project to
functional upgraded Django project, including
dependency updates.
• Doing frequent git rebasing & resolving merge
conflicts is terrible.
How to Upgrade to the Newest Shiniest Django Version
What is step zero?
pip uninstall django
pip install django==<NUMBER>
15
What NOT to do
Do not skip over versions. If you do, you
will
• miss deprecation warnings
• supported for 2 versions
• have invalid code
• call APIs or use modules that don’t
exist in newer Django version
16
What is step 1?
python manage.py tests




Possible results:
1. Your tests may not even run.
2. Your tests may fail.
3. All your tests pass.
17
Option 3: All your tests pass right after
installing new Django
Option 2: Your tests fail.
What’s next if tests fail?
Fix tests, one at a time
19
How to Upgrade to the Newest Shiniest Django Version
At the end, what does “SUCCESS”
look like for a fully upgraded project?
In this order:
1. All tests pass with no errors or deprecation
warnings.
2. UI works locally.
3. Deployment works on staging.
4. UI works on staging.
5. Deployment works on production.
6. UI works on production.
21
Break a big task into smaller tasks.
What is this entire process?
Run thru these steps in this order:
1. Run existing unit tests. Fix broken tests.
2. Run same existing unit tests. Confirm that
fewer tests fail.
3. Rinse and repeat steps 1-2 continuously
until all tests pass.
4. Check the UI to see if it all still works.
5. Edit deploy script, requirements.txt,
documentation.
22
What are the challenges?
23
> ls vendor/packages/
BeautifulSoup django-authopenid docutils odict south
Django django-celery feedparser ordereddict sphinx
Jinja2 django-debug-toolbar gdata python-dateutil sqlparse
PyJWT django-extensions ghettoq python-memcached
staticgenerator
PyYaml django-http-proxy html2text python-mimeparse twill
Pygments django-inplaceedit html5lib python-openid twisted
amqp django-invitation importlib python-otp
typecheck
anyjson django-kombu irc python-patch
unicodecsv
beautifulsoup4 django-model-utils jsmin python-social-auth
unittest-xml-reporting
bleach django-picklefield kombu pytz webob
celery django-registration markupsafe
Lots of dependencies may break
24
Options:
1. Upgrade dependency.
2. Patch it yourself (and upstream it).
3. Use a different similar dependency.
LOTS of release notes
• Deprecation warnings or test errors will tell
you which release notes to read.
• Replace syntax with newer syntax.
25
Some are simple changes
Upgrade to 1.5: Fix deprecation issue with
AdminMediaHandler
Edit manage.py when upgrading to Django 1.5
27
Some are simple changes
Replace "direct_to_template()" with generic template
view. This is a deprecation documented in Django 1.5
release notes.
LOTS of repetition
29
Fix the template quotes syntax issue
This syntax issue is documented in release notes when upgrading to Django 1.5.
In templates, change tags like {% url myview %} to {% url "myview" %}
Take aways
31
• Do an upgrade 1 version at a time.
• Run unit tests, see what breaks, then fix tests
1 at a time.
• Read release notes.
• Break every task into small steps.
• A checklist helps.
• So does taking notes.
32
How many people have
been planning to do an
upgrade on their Django
project?
Announcing Django Upgrade Open
Space
33
Have you done Django upgrades before or are
looking to do so for your personal project(s)?
WHO: Anyone who wants to upgrade their
projects. Anyone with experience with upgrading
projects.
WHAT: Work on your Django project. Mentor(s)
will be there.
WHEN: this Saturday & Sunday mornings
Thanks! Hope this helps.
Thanks Cisco for sponsoring
me to go on this trip.
Susan
Twitter: @ArcTanSusan
34
1 of 34

Recommended

Dot all 2019 | Testing with Craft | Giel Tettelar by
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarGiel Tettelaar
155 views27 slides
Putting the pro in programmer by
Putting the pro in programmerPutting the pro in programmer
Putting the pro in programmerSwitch Systems Ltd
595 views24 slides
Continuous Delivery, Continuous Integration by
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Amazon Web Services
3.6K views59 slides
Continuous integration and delivery by
Continuous integration and deliveryContinuous integration and delivery
Continuous integration and deliveryDanilo Pianini
497 views128 slides
How do you tame a big ball of mud? One test at a time. by
How do you tame a big ball of mud? One test at a time.How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.Matt Eland
859 views61 slides
Continuous delivery applied by
Continuous delivery appliedContinuous delivery applied
Continuous delivery appliedMike McGarr
2.9K views57 slides

More Related Content

What's hot

Blazing Fast Feedback Loops in the Java Universe by
Blazing Fast Feedback Loops in the Java UniverseBlazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java UniverseMichał Kordas
430 views55 slides
DevQAOps - Surviving in a DevOps World by
DevQAOps - Surviving in a DevOps WorldDevQAOps - Surviving in a DevOps World
DevQAOps - Surviving in a DevOps WorldWinston Laoh
80 views21 slides
TDD for APIs @ Europython 2015, Bilbao by Michael Kuehne by
TDD for APIs @ Europython 2015, Bilbao by Michael KuehneTDD for APIs @ Europython 2015, Bilbao by Michael Kuehne
TDD for APIs @ Europython 2015, Bilbao by Michael KuehneMichael Kuehne-Schlinkert
844 views22 slides
Comparing Agile QA Approaches to End-to-End Testing by
Comparing Agile QA Approaches to End-to-End TestingComparing Agile QA Approaches to End-to-End Testing
Comparing Agile QA Approaches to End-to-End TestingKatie Chin
2.6K views16 slides
Continuous integration by
Continuous integrationContinuous integration
Continuous integrationhugo lu
3.3K views28 slides
An almost complete continuous delivery pipeline including configuration manag... by
An almost complete continuous delivery pipeline including configuration manag...An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...ulfmansson
3.4K views55 slides

What's hot(20)

Blazing Fast Feedback Loops in the Java Universe by Michał Kordas
Blazing Fast Feedback Loops in the Java UniverseBlazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java Universe
Michał Kordas430 views
DevQAOps - Surviving in a DevOps World by Winston Laoh
DevQAOps - Surviving in a DevOps WorldDevQAOps - Surviving in a DevOps World
DevQAOps - Surviving in a DevOps World
Winston Laoh80 views
Comparing Agile QA Approaches to End-to-End Testing by Katie Chin
Comparing Agile QA Approaches to End-to-End TestingComparing Agile QA Approaches to End-to-End Testing
Comparing Agile QA Approaches to End-to-End Testing
Katie Chin2.6K views
Continuous integration by hugo lu
Continuous integrationContinuous integration
Continuous integration
hugo lu3.3K views
An almost complete continuous delivery pipeline including configuration manag... by ulfmansson
An almost complete continuous delivery pipeline including configuration manag...An almost complete continuous delivery pipeline including configuration manag...
An almost complete continuous delivery pipeline including configuration manag...
ulfmansson3.4K views
Step away from that knife! by Michael Goetz
Step away from that knife!Step away from that knife!
Step away from that knife!
Michael Goetz985 views
Continuous delivery - tools and techniques by Mike McGarr
Continuous delivery - tools and techniquesContinuous delivery - tools and techniques
Continuous delivery - tools and techniques
Mike McGarr13.8K views
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P... by Sauce Labs
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Closer To the Metal - Why and How We Use XCTest and Espresso by Mario Negro P...
Sauce Labs321 views
Introduction to Continuous Delivery (BBWorld/DevCon 2013) by Mike McGarr
Introduction to Continuous Delivery (BBWorld/DevCon 2013)Introduction to Continuous Delivery (BBWorld/DevCon 2013)
Introduction to Continuous Delivery (BBWorld/DevCon 2013)
Mike McGarr4.8K views
Back to basic: continuous integration (Madrid DevOps) by Sergio Navarro Pino
Back to basic: continuous integration (Madrid DevOps)Back to basic: continuous integration (Madrid DevOps)
Back to basic: continuous integration (Madrid DevOps)
Continuous Integration and Continuous Deployment in Enterprise scenario by Davide Benvegnù
Continuous Integration and Continuous Deployment in Enterprise scenarioContinuous Integration and Continuous Deployment in Enterprise scenario
Continuous Integration and Continuous Deployment in Enterprise scenario
Davide Benvegnù1.2K views
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery by Stephen Garrett
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and DeliveryUsg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery
Usg Web Tech Day 2016 - Continuous Integration, Deployment, and Delivery
Stephen Garrett603 views
Introduction to test_driven_development by haochenglee
Introduction to test_driven_developmentIntroduction to test_driven_development
Introduction to test_driven_development
haochenglee1.2K views
Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality by Daniel Gallego Vico
 Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
Software development terminology by jstack
Software development terminologySoftware development terminology
Software development terminology
jstack1.4K views

Viewers also liked

Dom(document object model) by
Dom(document object model)Dom(document object model)
Dom(document object model)Partnered Health
2.5K views20 slides
What to consider before buying a fingerprint gun safe? by
What to consider before buying a fingerprint gun safe?What to consider before buying a fingerprint gun safe?
What to consider before buying a fingerprint gun safe?Avinash Thota
58 views1 slide
Chicken patagoniensis by
Chicken patagoniensisChicken patagoniensis
Chicken patagoniensisMabel Ribicich
142 views4 slides
Message by
MessageMessage
MessageNada Sokrat
359 views23 slides
IML Group Overview September 2015 by
IML Group Overview September 2015IML Group Overview September 2015
IML Group Overview September 2015Shaun Barnard
260 views29 slides
Oct 23 CAPHC CPDSN Symposium - Shauna Langenberger by
Oct 23   CAPHC CPDSN Symposium - Shauna LangenbergerOct 23   CAPHC CPDSN Symposium - Shauna Langenberger
Oct 23 CAPHC CPDSN Symposium - Shauna LangenbergerGlenna Gosewich
44 views7 slides

Viewers also liked(20)

What to consider before buying a fingerprint gun safe? by Avinash Thota
What to consider before buying a fingerprint gun safe?What to consider before buying a fingerprint gun safe?
What to consider before buying a fingerprint gun safe?
Avinash Thota58 views
IML Group Overview September 2015 by Shaun Barnard
IML Group Overview September 2015IML Group Overview September 2015
IML Group Overview September 2015
Shaun Barnard260 views
Oct 23 CAPHC CPDSN Symposium - Shauna Langenberger by Glenna Gosewich
Oct 23   CAPHC CPDSN Symposium - Shauna LangenbergerOct 23   CAPHC CPDSN Symposium - Shauna Langenberger
Oct 23 CAPHC CPDSN Symposium - Shauna Langenberger
Glenna Gosewich44 views
地域のチカラをマップにしよう!高齢者版(20161119) by Hitoshi Sugimoto
地域のチカラをマップにしよう!高齢者版(20161119)地域のチカラをマップにしよう!高齢者版(20161119)
地域のチカラをマップにしよう!高齢者版(20161119)
Hitoshi Sugimoto319 views
マーケティング3.0 セミナー資料 by 潤 櫻田
マーケティング3.0 セミナー資料マーケティング3.0 セミナー資料
マーケティング3.0 セミナー資料
潤 櫻田4.5K views
Human Trafficking Awareness by Meri Ferrell
Human Trafficking AwarenessHuman Trafficking Awareness
Human Trafficking Awareness
Meri Ferrell104 views
Document Object Model by Mayur Mudgal
Document Object ModelDocument Object Model
Document Object Model
Mayur Mudgal2.7K views
DOM ( Document Object Model ) by ITSTB
DOM ( Document Object Model )DOM ( Document Object Model )
DOM ( Document Object Model )
ITSTB2.3K views
Changing Notions of Risk Management in Financial Markets by QuantInsti
Changing Notions of Risk Management in Financial MarketsChanging Notions of Risk Management in Financial Markets
Changing Notions of Risk Management in Financial Markets
QuantInsti1.1K views
research findings 1 by Maci Slater
research findings 1research findings 1
research findings 1
Maci Slater110 views
Document object model(dom) by rahul kundu
Document object model(dom)Document object model(dom)
Document object model(dom)
rahul kundu2K views
NLP Sitemap SMX 2016 Patrick Stox Latest In Advanced Technical SEO by patrickstox
NLP Sitemap SMX 2016 Patrick Stox Latest In Advanced Technical SEONLP Sitemap SMX 2016 Patrick Stox Latest In Advanced Technical SEO
NLP Sitemap SMX 2016 Patrick Stox Latest In Advanced Technical SEO
patrickstox30.8K views
ازاي تبني استراتيجية للمحتوى؟ by Hatem Hegazy
 ازاي تبني استراتيجية للمحتوى؟ ازاي تبني استراتيجية للمحتوى؟
ازاي تبني استراتيجية للمحتوى؟
Hatem Hegazy522 views
An Introduction to the DOM by Mindy McAdams
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
Mindy McAdams4.6K views

Similar to How to Upgrade to the Newest Shiniest Django Version

Creating a reasonable project boilerplate by
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplateStanislav Petrov
104 views36 slides
Django Article V0 by
Django Article V0Django Article V0
Django Article V0Udi Bauman
2K views23 slides
Test parallelization using Jenkins by
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using JenkinsRogue Wave Software
926 views58 slides
Django by
DjangoDjango
Djangochaitanayasethi
279 views20 slides
Django Girls Tutorial by
Django Girls TutorialDjango Girls Tutorial
Django Girls TutorialKishimi Ibrahim Ishaq
2K views79 slides
Different phases of accessibility testing by
Different phases of accessibility testing Different phases of accessibility testing
Different phases of accessibility testing SAGAR BARBHAYA
44 views34 slides

Similar to How to Upgrade to the Newest Shiniest Django Version(20)

Creating a reasonable project boilerplate by Stanislav Petrov
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov104 views
Django Article V0 by Udi Bauman
Django Article V0Django Article V0
Django Article V0
Udi Bauman2K views
Different phases of accessibility testing by SAGAR BARBHAYA
Different phases of accessibility testing Different phases of accessibility testing
Different phases of accessibility testing
SAGAR BARBHAYA44 views
Complete python toolbox for modern developers by Jan Giacomelli
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developers
Jan Giacomelli125 views
Continuous delivery in Qbon by Jaric Kuo
Continuous delivery  in QbonContinuous delivery  in Qbon
Continuous delivery in Qbon
Jaric Kuo365 views
Continuous delivery @wcap 5-09-2013 by David Funaro
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013
David Funaro1.5K views
Python to go by Weng Wei
Python to goPython to go
Python to go
Weng Wei8.5K views
Webinar - Continuous Integration with GitLab by OlinData
Webinar - Continuous Integration with GitLabWebinar - Continuous Integration with GitLab
Webinar - Continuous Integration with GitLab
OlinData1.1K views
Django simplified : by weever mbakaya by Mbakaya Kwatukha
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
Mbakaya Kwatukha157 views
Django: Beyond Basics by arunvr
Django: Beyond BasicsDjango: Beyond Basics
Django: Beyond Basics
arunvr2.2K views
Python monorepos what, why and how (shared) by benjyw
Python monorepos  what, why and how (shared)Python monorepos  what, why and how (shared)
Python monorepos what, why and how (shared)
benjyw126 views
Pulp 3 - Simpler, Better, More awesome by Dennis Kliban
Pulp 3 - Simpler, Better, More awesomePulp 3 - Simpler, Better, More awesome
Pulp 3 - Simpler, Better, More awesome
Dennis Kliban285 views

More from Susan Tan

Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic... by
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...Susan Tan
541 views31 slides
Let's read code: python-requests library by
Let's read code: python-requests libraryLet's read code: python-requests library
Let's read code: python-requests librarySusan Tan
2.7K views71 slides
How do I run multiple python apps in 1 command line under 1 WSGI app? by
How do I run multiple python apps in 1 command line under 1 WSGI app?How do I run multiple python apps in 1 command line under 1 WSGI app?
How do I run multiple python apps in 1 command line under 1 WSGI app?Susan Tan
1.6K views11 slides
Let's read code: the python-requests library by
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests librarySusan Tan
11.5K views73 slides
How to Really Get Git by
How to Really Get GitHow to Really Get Git
How to Really Get GitSusan Tan
1.8K views57 slides
Python In The Browser: Intro to Brython by
Python In The Browser: Intro to BrythonPython In The Browser: Intro to Brython
Python In The Browser: Intro to BrythonSusan Tan
4.2K views33 slides

More from Susan Tan(7)

Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic... by Susan Tan
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Rants and Ruminations From A Job Applicant After 💯 CS Job Interviews in Silic...
Susan Tan541 views
Let's read code: python-requests library by Susan Tan
Let's read code: python-requests libraryLet's read code: python-requests library
Let's read code: python-requests library
Susan Tan2.7K views
How do I run multiple python apps in 1 command line under 1 WSGI app? by Susan Tan
How do I run multiple python apps in 1 command line under 1 WSGI app?How do I run multiple python apps in 1 command line under 1 WSGI app?
How do I run multiple python apps in 1 command line under 1 WSGI app?
Susan Tan1.6K views
Let's read code: the python-requests library by Susan Tan
Let's read code: the python-requests libraryLet's read code: the python-requests library
Let's read code: the python-requests library
Susan Tan11.5K views
How to Really Get Git by Susan Tan
How to Really Get GitHow to Really Get Git
How to Really Get Git
Susan Tan1.8K views
Python In The Browser: Intro to Brython by Susan Tan
Python In The Browser: Intro to BrythonPython In The Browser: Intro to Brython
Python In The Browser: Intro to Brython
Susan Tan4.2K views
How to choose an open-source project by Susan Tan
How to choose an open-source projectHow to choose an open-source project
How to choose an open-source project
Susan Tan1K views

Recently uploaded

DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon by
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDeltares
11 views43 slides
Software evolution understanding: Automatic extraction of software identifier... by
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...Ra'Fat Al-Msie'deen
7 views33 slides
Winter '24 Release Chat.pdf by
Winter '24 Release Chat.pdfWinter '24 Release Chat.pdf
Winter '24 Release Chat.pdfmelbourneauuser
9 views20 slides
Keep by
KeepKeep
KeepGeniusee
71 views10 slides
WebAssembly by
WebAssemblyWebAssembly
WebAssemblyJens Siebert
32 views18 slides
Fleet Management Software in India by
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India Fleetable
11 views1 slide

Recently uploaded(20)

DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon by Deltares
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
Deltares11 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea... by Safe Software
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Geospatial Synergy: Amplifying Efficiency with FME & Esri ft. Peak Guest Spea...
Safe Software391 views
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit... by Deltares
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...
Deltares12 views
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
Deltares16 views
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... by Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares7 views
Copilot Prompting Toolkit_All Resources.pdf by Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana6 views
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida by Deltares
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - PridaDSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
Deltares17 views
Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ... by marksimpsongw
Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ...Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ...
Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ...
marksimpsongw74 views
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... by Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares10 views
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx by animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm11 views

How to Upgrade to the Newest Shiniest Django Version

  • 1. How to upgrade to the newest shiniest Django version DjangoCon Europe Susan tan Cisco in san francisco, CA 1
  • 2. Hello! I’m Susan • I’m a software engineer at Cisco in San Francisco, CA. • Previously worked at a cloud startup Piston. • Works with python apis, web development, works on Cisco’s openstack horizon Django project • Worked on open source Django project www.openhatch.org 2
  • 3. Quick Audience Survey How many people currently work on at least one project with Django • below 1.6? • 1.7? • 1.8? • 1.9? 3
  • 4. Why should you do an upgrade? • get new features, bug fixes, security fixes • easier to upgrade to the next version in future 4
  • 5. A.B.C 
 backwards-incompatible new features backwards compatible backwards-compatible bug fixes. Semantic versioning review major minor patch Read http://semver.org/ 5
  • 6. Django does NOT follow semantic versioning FYI 6 • Major release number is an extension of minor release number. • From semantic versioning, Django 1.7 should be 2.0, because backwards-incompatible.
  • 7. When is right time to upgrade? • Your project’s Django version is no longer supported. • Do a patch upgrade! Always. • You have an existing comprehensive test suite. • If you don’t have a test suite, then now would be a good time to start writing unit tests. 7
  • 8. 8 Current Django Versions Source: https://www.djangoproject.com/download/
  • 10. • Hard to know how much time or effort it takes • Hard to know which tests will break or even run • Hard to know if UI will continue working • Confirm functionality at every part of development • ie: local host, staging, deployment. 10 Why is upgrading a Django project a difficult thing to do?
  • 11. What does the end product look like in code? 11
  • 13. Upgrading OpenHatch 13 • OpenHatch vendors all its dependencies. • Commits that are "Add upgraded version of library Z” with full library source code. • ~4 weeks to go from broken Django project to functional upgraded Django project, including dependency updates. • Doing frequent git rebasing & resolving merge conflicts is terrible.
  • 15. What is step zero? pip uninstall django pip install django==<NUMBER> 15
  • 16. What NOT to do Do not skip over versions. If you do, you will • miss deprecation warnings • supported for 2 versions • have invalid code • call APIs or use modules that don’t exist in newer Django version 16
  • 17. What is step 1? python manage.py tests 
 
 Possible results: 1. Your tests may not even run. 2. Your tests may fail. 3. All your tests pass. 17
  • 18. Option 3: All your tests pass right after installing new Django
  • 19. Option 2: Your tests fail. What’s next if tests fail? Fix tests, one at a time 19
  • 21. At the end, what does “SUCCESS” look like for a fully upgraded project? In this order: 1. All tests pass with no errors or deprecation warnings. 2. UI works locally. 3. Deployment works on staging. 4. UI works on staging. 5. Deployment works on production. 6. UI works on production. 21 Break a big task into smaller tasks.
  • 22. What is this entire process? Run thru these steps in this order: 1. Run existing unit tests. Fix broken tests. 2. Run same existing unit tests. Confirm that fewer tests fail. 3. Rinse and repeat steps 1-2 continuously until all tests pass. 4. Check the UI to see if it all still works. 5. Edit deploy script, requirements.txt, documentation. 22
  • 23. What are the challenges? 23
  • 24. > ls vendor/packages/ BeautifulSoup django-authopenid docutils odict south Django django-celery feedparser ordereddict sphinx Jinja2 django-debug-toolbar gdata python-dateutil sqlparse PyJWT django-extensions ghettoq python-memcached staticgenerator PyYaml django-http-proxy html2text python-mimeparse twill Pygments django-inplaceedit html5lib python-openid twisted amqp django-invitation importlib python-otp typecheck anyjson django-kombu irc python-patch unicodecsv beautifulsoup4 django-model-utils jsmin python-social-auth unittest-xml-reporting bleach django-picklefield kombu pytz webob celery django-registration markupsafe Lots of dependencies may break 24 Options: 1. Upgrade dependency. 2. Patch it yourself (and upstream it). 3. Use a different similar dependency.
  • 25. LOTS of release notes • Deprecation warnings or test errors will tell you which release notes to read. • Replace syntax with newer syntax. 25
  • 26. Some are simple changes Upgrade to 1.5: Fix deprecation issue with AdminMediaHandler
  • 27. Edit manage.py when upgrading to Django 1.5 27 Some are simple changes
  • 28. Replace "direct_to_template()" with generic template view. This is a deprecation documented in Django 1.5 release notes.
  • 30. Fix the template quotes syntax issue This syntax issue is documented in release notes when upgrading to Django 1.5. In templates, change tags like {% url myview %} to {% url "myview" %}
  • 31. Take aways 31 • Do an upgrade 1 version at a time. • Run unit tests, see what breaks, then fix tests 1 at a time. • Read release notes. • Break every task into small steps. • A checklist helps. • So does taking notes.
  • 32. 32 How many people have been planning to do an upgrade on their Django project?
  • 33. Announcing Django Upgrade Open Space 33 Have you done Django upgrades before or are looking to do so for your personal project(s)? WHO: Anyone who wants to upgrade their projects. Anyone with experience with upgrading projects. WHAT: Work on your Django project. Mentor(s) will be there. WHEN: this Saturday & Sunday mornings
  • 34. Thanks! Hope this helps. Thanks Cisco for sponsoring me to go on this trip. Susan Twitter: @ArcTanSusan 34