How to upgrade django?

后端 未结 15 1351
情歌与酒
情歌与酒 2021-01-31 07:57

My project was running on Django 1.5.4 and I wanted to upgrade it. I did pip install -U -I django and now pip freeze shows Django 1.6.5 (clearly django

15条回答
  •  迷失自我
    2021-01-31 08:26

    The method outlined in the docs is correct -
    https://docs.djangoproject.com/en/3.0/howto/upgrade-version/

    What I can add to the above answers is the rationale. If you're very far behind in Django versions (ex. 1.5 -> and you want to go to 2.0) the developers only want you to upgrade one step at a time. ex. 1.5 -> 1.6 -> 1.7 etc.

    The purpose being that this limits the amount of things that break on upgrading. You should include the -Wa warning flags every time you upgrade a step, so you can fix deprecated features before they are removed in future upgrades.

    A feature is generally deprecated for a couple of versions, and then removed entirely. So this gives you the ability to keep the app stable while upgrading.

提交回复
热议问题