部署带有依赖项的 Django 开源应用程序

发布于 2024-08-09 19:54:03 字数 502 浏览 10 评论 0原文

我正在与一位朋友合作开发一个我们想要分发的 Web 应用程序,并且我们正在 Django 中工作。

我想确保潜在用户的部署尽可能简单。 Django 似乎大量使用共享安装库,我希望人们只需要下载我们的最新版本,解压缩,编辑一两个配置文件即可开始,就像 wordpress 等。

我习惯了 ruby​​ on Rails风格部署,您可以将 gems 和插件活塞化到供应商目录中,这就是您所需要依赖的。

部署捆绑所有依赖项的应用程序的类似 django 方法是什么?我不想在安装后使用诸如 easy_install 之类的东西来拉取依赖项。

此 Python 堆栈溢出答案似乎是在正确的轨道上,但是django有特定的方法吗?这是一个已解决的问题吗?

I'm working with a friend on a web application we'd like to distribute and we're working in Django.

I'd like to make sure deployment is as easy as possible for potential users. It seems that Django uses shared installed libraries alot and I'd like for folks to just need to download our latest version, unzip, edit a config file or two and get started, like wordpress etc.

I'm used to the ruby on rails style deployment where you pistonize your gems and plugins into a vendor directory and that's all you need to rely on.

What's the analogous django way to deploy an application with all of the dependencies bundled? I'd prefer not to have to use something like easy_install to pull down dependencies after install.

This Python Stack Overflow Answer seems like it is on the right track, but is there a django specific way to go? Is this a solved problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深海夜未眠 2024-08-16 19:54:03

最好的选择是使用 pip。 pip 是一个用于安装 python 包的实用程序。它允许您创建列出项目依赖项的需求文件。 pip 非常常见,并且被 Django 社区广泛使用,我强烈推荐使用它。

正如 T. Stone 提到的 Pinax,基于 Django 的项目有很多依赖项,并且它们非常成功地利用了 pip 需求文件。

Your best bet here is to make use of pip. pip is a utility for installing python packages. it allows you to create requirements files that list dependencies for a project. pip is quite common and widely used by the Django community, and I would highly recommend using it.

As T. Stone mentioned Pinax, a Django-based project has many dependencies and they make use of pip requirements files quite sucessfully.

岁吢 2024-08-16 19:54:03

这是 Django“可重用应用程序”的一大限制。在一两周前的“This Week in Django”播客中,他们正在讨论这个确切问题。看来大家达成共识,而且我也同意,确实没有解决方案。

如果您查看 Pynax,它可能是最大的分布式 Django 项目,您会发现他们将应用程序与整个系统捆绑在一起。

Python 本身有一些软件包发行版。我知道 ActiveState 正在着手启动另一个。但即便如此,也并非所有 django 应用程序都被打包。许多只能在 bitbucket、github 或 google 源代码中找到。即便如此,要获得所有这些的副本,也需要安装 Mercurial、git 和 svn。 (等等@那个)

你在这里基本上有两个选择:

  1. 在你的源代码中包含每个依赖项的副本
  2. 包含用户如何安装给定依赖项的文档

我知道这是一个悲伤的列表。 它实际上很糟糕,特别是在使用 ruby​​ gem 系统之后,但目前我不确定您会找到什么更好的。

如果有任何兴趣,我写了一篇简短的博客文章,介绍如何将依赖项保留在项目文件夹(或 SVN)中,然后将该路径添加到 django 开头的 Python 搜索路径。 ( 通过 SVN 管理 Django 依赖项 )搞砸了 Komodo Edit 的智能感知,但它确实让事情变得更容易。

This is one of the big limitations with the Django "Reusable app". On the "This Week in Django" podcast a week or two ago they were talking about this exact problem. It seems the consensus, and I agree, is that there really isn't a solution.

If you look at Pynax, which is probably the largest distributed Django project, you'll see they are bundling the apps with the whole system.

Python itself has a few package distributions. I know ActiveState is working on starting up another. But even then not all of the django apps are packaged. Many are only found in bitbucket, github, or google source. And even then, to get a copy of all those requires one to have mercurial, git, and svn installed. (blah @ that)

You basically have 2 options here:

  1. Include a copy of every dependency with your source
  2. Include documentation for how the users install a given dependency

It's a sad list, I know. It sucks actually, especially after using the ruby gem system, but at the moment I'm not sure what better you're going to find.

If it's of any interest, I wrote a short blog post about keeping dependencies in your project's folder (or in SVN) and then adding that path to Python's search path at the start of django. ( Managing Django Dependencies via SVN ) It screws up Komodo Edit's intellisense, but it does make things easier otherwise.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文