How to upgrade django?

后端 未结 15 1340
情歌与酒
情歌与酒 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:25
    pip install --upgrade django
    

    works just fine, but before upgrading it's highly recommended to read this part from the documentation: https://docs.djangoproject.com/en/2.1/howto/upgrade-version/

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-31 08:28

    You can use the upgraded version after upgrading.

    You should check that all your tests pass before deploying :-)

    0 讨论(0)
提交回复
热议问题