升级Django版本:最佳做法 [英] Upgrading Django Version: Best Practice

查看:383
本文介绍了升级Django版本:最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大量用Django 1.5编写的代码库,现在是时候升级到最新版本(1.11.2)了,因为很多东西都无法正常工作.

I've pretty big code base written on Django 1.5, it's about time to upgrade to the newest version (1.11.2) as many stuff don't work well.

我想知道是否最好逐步升级:1.5-> 1.6-> 1.7 ... 或者只是跳到1.11.2

I'm wondering if it's best to upgrade step by step: 1.5->1.6->1.7... or just jump to 1.11.2

哪种方法应该更好,并使(困难的)过程更容易?因为我的项目有很多依赖项?

what method should be better and make the (hard) process easier? as my project has many dependencies?

还有什么好的做法呢?我正在使用virtualenv,并且了解到有关升级的Django文章

Also what are good practices to do? I'm using virtualenv and aware of this Django article about upgrading

推荐答案

找到的文档("将Django升级到新版本")是一个很好的指南.

The document you found ("Upgrading Django to a newer version") has a good guide.

  • 升级之前的一个重要部分是,在升级之前,自动测试套件为您的应用程序具有完整的分支机构覆盖范围.

  • An important part, before upgrading, is to have full branch coverage by the automated test suite for your application, before upgrading.

您希望能够运行一个完整的自动化测试套件,看到所有通过,并且知道测试套件将行使所有分支.

You want to be able to run a full automated test suite, see everything pass and know that all branches are exercised by the test suite.

这意味着当您通过移植到新的Django版本破坏某些内容时,您将能够查看应用程序的哪些部分不再正常运行.

This means that when you break something by porting to the new Django version, you'll be able to see which parts of your app are not behaving correctly any more.

通过阅读发行说明弃用时间轴,以获取当前版本之间的所有相关版本和目标Django版本.

Read about what changes you need to make by reading the release notes and deprecation timeline, for all of the relevant releases between your current and target Django versions.

查看需要为Django升级的依赖项;如果代码依赖于过时的第三方库中的不兼容功能,则可能需要更正您的代码.

See what dependencies you'll need to upgrade for Django; you might need to correct your code if it relies on incompatible features in an outdated third-party library.

所有应该在升级单个产品之前完成.

All of those should be done before upgrading a single thing, in my opinion.

这篇关于升级Django版本:最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆