在版本控制中存储 Django 和应用程序代码的好处
我试图简化我们的应用程序的部署,并更轻松地管理我们依赖的库和框架的版本。
将 Django 存储在我们的 VCS 中有意义吗?理想情况下,这将使我更轻松地简化部署,并且我可以使用 South 管理 Django 对内置应用程序(django.contrib.auth、django.contrib.sites 等)所做的任何模型更改。
我有什么理由不应该这样做吗?您为您的应用程序做什么?
I'm trying to simply the deployment of our application and more easily manage the versions of libraries and frameworks that we depend on.
Does storing Django in our VCS make sense? This would ideally make it easier for me to streamline deployment and I can manage any model changes that Django makes to the built-in apps (django.contrib.auth, django.contrib.sites, etc.) using South.
Are there reasons why I shouldn't do this? What do you do for your apps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我绝对会把所有东西都存储在你的 VCS 中。想要更新 Django?想要添加插件吗?在几个开发人员和不同环境之间同步可能是一场噩梦。如果版本不同步,不必调试它。如果您需要使用多个 django 应用程序并且它们是不同的版本,会发生什么情况?
您可能需要查看以下两篇文章:
我存储 virtualenv 在 SVN 中创建的目录中的所有内容。我的部署脚本基本上由以下内容组成:
I would absolutely store everything in your VCS. Want to update Django? Want to add a plugin? Synchronising this across a few developers and different environments could be a nightmare. Nevermind having to debug this if the versions go out of sync. What happens if you have multiple django apps that you need to work on and they're different versions?
You might want to take a look at the following two articles:
I store everything from the directory that virtualenv creates in SVN. My deployment script basically consists of the following:
我认为将 Django 本身存储在版本控制中不会获得太多好处,除非您使用的是 Django 的修改版本。听起来您正在与其他开发人员合作,因此一定要将您正在处理的代码存储在某些 VCS 中(即使单独工作也有很多好处)。
为了部署您的应用程序,您可能会发现构建一个可以指定其依赖项(例如特定版本的 Django)的 distutils 包是值得的。使用 virtualenv 将有助于跟踪依赖关系。
我建议,要发布到生产服务器,您应该“标记”每个版本,然后将其导出到您的生产系统,而不是检查它。这有助于阻止人们更新标签内的内容以及从版本控制进行更新。
我认为在发布到生产系统时值得做的另一件事是为每次导出的代码创建一个新目录,其中包括发布号,然后有一个指向活动版本的符号链接。这使您可以轻松回滚到以前的版本。你提到的南方对此也很有帮助。
I don't think you'll gain much by storing Django itself in version control unless you are using a modified version of Django. It sounds like you're working with other developers, so definitely store code you're working on in some VCS (even working alone there are plenty of benefits).
For deploying your application you may find it's worth building a distutils package which can specify its dependencies (such as a specific version of Django). Using virtualenv will help keep track of dependencies.
I would suggest that for releasing to a production server you should "tag" each release and then export that to your production system, rather than checking it out. This helps to stop people updating things within the tag and updating from version control.
Another thing that I think is worthwhile doing when releasing to a production system is creating a new directory for each export of the code which includes the release number, then have a symlink pointing to the active version. This allows you to roll back to a previous version easily. South, which you mention is also very helpful for this.