在配置包中部署Django与virtualenv? [英] Deploying Django with virtualenv inside a distribution package?

查看:118
本文介绍了在配置包中部署Django与virtualenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在SuSE Linux Enterprise 11系统上部署一个Django应用程序。公司规则说我只需要部署RPM。虽然我可以为每个依赖关系使用 ./ setup.py bdist_rpm ,但并不真实,因为RPM并没有记录所有的依赖关系。因此,手动使用RPM和管理依赖关系并不是真正的优势,而且我想避免使用RPM。



现在我有以下想法:在构建一个包,我可以创建一个 virtualenv ,通过 pip / / code>安装所有的依赖项,然后将其与其余部分打包的代码转换成一个固定的RPM。



这种方法有多聪明?

解决方案>

我一直在使用这种方法大概一年了,而且已经很好了。



一个人是你想要查看任何python脚本中的bang行写入virtualenv的bin目录。这些将最终成为您的构建环境中使用的完整路径名,这可能不是最终安装virtualenv的目录。所以您可能需要在RPM的安装后添加一些sed调用来调整路径。


I have to deploy a Django application onto a SuSE Linux Enterprise 11 system. Corporate rules say I need to deploy using RPMs only. While I can use ./setup.py bdist_rpm for each dependency, it's not really sane, since RPM doesn't record all of the dependencies yet. Therefore I'd have no real advantage in using RPMs and managing dependencies manually is somewhat cumbersome and I would like to avoid it.

Now I had the following idea: While building a package, I could create a virtualenv, install all my dependencies via pip there and then package it up with the rest of the code into one solid RPM.

How sensible is this approach?

解决方案

I've been using this approach for about a year now and it has worked out pretty well.

One gotcha is that you'll want to check out the bang lines in any python scripts written to the virtualenv's bin directory. These will end up being full path names used in your build environment, which probably won't be the same directory where you end up installing the virtualenv. So you may need to add some sed calls in your RPM's postinstall to adjust the paths.

这篇关于在配置包中部署Django与virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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