Upgrading Django Version: Best Practice

三世轮回 提交于 2019-12-23 01:03:43

问题


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.

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?

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


回答1:


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.

    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.

  • 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.

  • 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.




回答2:


It depends on two things. How many people are using the Django app, and the extend of your test coverage.

If you are the only user, no worries, upgrade all the way. But if you have a lot of users you will quickly find out by upgrading all the way to 1.11.2 that some edge cases may not be covered by your tests.

Expect a lot of error 500 along the way.

If your coverage is close to 100% on all your apps, you may not have that problem.

Note that a lot has changed since 1.5.




回答3:


I my case about: Data

I am using SQLite and i am sure that, the lastest version can kill you if you have only 1 conflict.

python manage.py makemigrations and so on had so many chance in it's method.

And if you change Python from 2x to 3x, it is a new case too =))



来源:https://stackoverflow.com/questions/44378695/upgrading-django-version-best-practice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!