将django项目从1.3.7升级到1.6或1.7是最好的方法 [英] What is the best method to upgrade a django project from 1.3.7 to 1.6 or 1.7

查看:128
本文介绍了将django项目从1.3.7升级到1.6或1.7是最好的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要升级的Django项目。我应该通过1.6进行一个新的项目,并从Django 1.3逐个移动到1.6,还是还有一些简单的方法?

解决方案

p> 文档建议,请按步骤


  1. 创建一个新的virtualenv,在其中安装新的django版本,其中包含所有必需的依赖关系。这样你就可以将它与旧版本分开

  2. 创建并运行测试套装。确保您使用 -Wall 命令运行测试无效警告

  3. 部署时,请确保清除缓存

更多个人笔记:



从我的经验,我也建议你去发行说明,后一个版本其他,扫描主要变化。虽然有些事情仍然得到支持,并且会为您而工作,但并不意味着其中一个较新的版本没有提供更好的方法来执行相同的操作。



一个很好的例子是 render 。它作为1.3版本中的 render_to_response 替代,但它并没有赶上。仍然支持 render_to_response ,而没有任何贬低来了。但与时俱进仍然是好习惯。



另一个个人建议 - 使用新的django版本重新创建应用程序,然后复制文件。这是因为新版本对其settings.py和其他文件使用不同的模板,并且可能会立即强调您所带来的一些更改(例如 ALLOWED_HOSTS (1.5)。



<祝你好运!希望不会 痛苦



p.s。 - 考虑等待一段时间 - Django 1.7即将推出,预计将是自Django 1.0以来的最大版本。另一方面,从1.6升级到1.7升级可能比从1.3升级到1.7更容易。我不知道这里是最好的课程,但请考虑一下。


I've a project on Django that needs an upgradation. Should I proceed by making a new project on 1.6 and shifting one by one from Django 1.3 to 1.6 or there's some other easy method?

解决方案

What the documentation recommends, do it in steps

  1. create a new virtualenv, install the new django version in it with all required dependencies for your app. That way you keep it seperated from the old version
  2. create and run a test suit. Make sure you run the test with the -Wall command to unsilence warnings
  3. When you deploy, make sure to clear your cache

A more personal note:

From my experience, I also recommend you go to the release notes, go one version after the other, and scan the major changes. While some things are still supported, and will work for you, it doesn't mean that one of the newer version didn't present a better method to do the same thing.

One good example would be the render. It was presented as an alternative to render_to_response back in version 1.3, but it didn't catch on that fast. The render_to_response is still supported, and there isn't any deprecation coming. But it's still good habit to get with the times.

Another personal suggestion - recreate the apps with the new django version, and then copy the files. That's because the new versions use different templating for their settings.py and other files, and it might immediatly highlight to you some of the changes that were brought (such as ALLOWED_HOSTS which was presented in 1.5).

Good luck! Hope it wouldn't be too painful

p.s. - consider waiting a little while longer - Django 1.7 is coming soon, and it's expected to be the biggest release since Django 1.0. Though, on the other hand, upgrading from 1.6 to 1.7 will probably be easier than upgrading from 1.3 to 1.7. I'm not sure what's the best course here, but consider it.

这篇关于将django项目从1.3.7升级到1.6或1.7是最好的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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