如何使用 Spawning 部署 Django

发布于 2024-07-12 12:54:16 字数 330 浏览 15 评论 0原文

没有太多关于如何使用 Spawning 部署 Django 项目的文档,但人们仍在推荐它通过 apache/mod_wsgi。

在另一个类似的问题中,其他SO用户建议了我提出一个特定于生成的新问题,因此希望其他人也可以分享他们的经验。

There's no much documentation on how to deploy a Django project with Spawning and yet people are recommending it over apache/mod_wsgi.

In another similar question, other SO user suggested me to open a new question specific to Spawning, so hopefully others can share their experiences too.

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

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

发布评论

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

评论(4

凉世弥音 2024-07-19 12:54:16

我有兴趣看看谁认真推荐 Spawning over Apache 和 mod_python 或 mod_wsgi。

从这个问题现在是 Google 'django spawning' 的第四个结果来看,我想说现在还为时过早。 :) 如果您要将任何重要的内容投入生产,请暂时使用 Apache/mod_wsgi。

I'd be interested in seeing whose seriously recommending Spawning over Apache and mod_python or mod_wsgi.

Judging by the fact that this question is now the #4 result in Google for 'django spawning' I'd say it's very much early days. :) If you're putting anything serious into production stick to Apache/mod_wsgi for now.

小情绪 2024-07-19 12:54:16

cd 到 django 的 settings.py 目录。

这是为您的 django 应用程序提供服务的命令行

spawn --factory=spawning.django_factory.config_factory settings --port 80

cd to your django's settings.py directory.

Here is the command line to serve your django application

spawn --factory=spawning.django_factory.config_factory settings --port 80
丑疤怪 2024-07-19 12:54:16

Eric Florenzo 做了一些生成的基本测试。 确保阅读所有评论以及主要帖子。

就我个人而言,我总是喜欢研究这类解决方案,但在这种情况下,我什至无法进入基准测试阶段。 Apache 有太多我需要的重要功能(ssl 客户端证书、在 fastcgi 下运行 mongrel 服务器、wsgi 下的 django、php gasp、直接提供静态文件、每个 IP 地址的 ssl、数十个虚拟主机多个 IP 地址等)。

Eric Florenzo did some basic testing of spawning. Make sure and read all the comments as well as the main post.

Personally I always like investigating these kinds of solutions, but in this case I just can't even get to a benchmarking stage. There are too many important features I need in Apache (ssl client certs, run mongrel servers under fastcgi, django under wsgi, php gasp, static files served directly, ssl for each ip address, dozens of virtual hosts on multiple ip addresses, etc.).

吹梦到西洲 2024-07-19 12:54:16

是的,我可以建议您在 apache/wsgi 设置上使用生成。

基本上有两个原因:
1) 内存使用(生成时会节省一些 MB)
2)动态代码重新加载(在任何时候,您的用户都会看到404或500页面)

这来自经验,我正在运行 http在此设置中,spawning+nginx 上的://tunesdiary.com

nginx 处理所有传入负载,进一步代理连接到正在侦听非特权端口的spawning(意味着spawning 以与网络不同的用户身份运行)服务器)
Spawning 会产生 4 个进程,每个进程有 2 个线程。 (适用于当前负载)。

当我将任何代码推送到服务器时,之前的请求都会得到处理,然后新代码开始为新请求提供服务。

到目前为止,这一直工作得很好(我从大约 6 个月开始运行)

据我观察,django 与 mod wsgi + apache(我几天前使用过)在开始后占用了大约 70MB 的 RAM(单进程),此设置每个进程使用 45MB 左右。
另外,我也用过lighttpd + modfcgi,它也消耗了与spwaning几乎相同的内存量。

(我可能计算错误了,因为在apache中,网络服务器的内存使用也包括在内)

据我所知,你可以依赖spawning,但如果你不经常推送,它就没有多大用处。

Yes, I could recommend you to use spawning over apache/wsgi setup.

Two reasons basically:
1) Memory usage (you'll save some MBs on spawning)
2) Dynamic code reloading (at no point of time, your user's will see a 404 or 500 page)

This comes from experience, I am running http://tunesdiary.com on spawning+nginx in this setup:

nginx handles all the incoming load which further proxy connection to spawning which is listening on a unprivileged port (means spawning is running as a different user than the web-server)
Spawning spawns 4 processes with 2 threads per process. (works for the current load).

As I push any code to the server, the previous requests are handled, and then the new code starts serving the new requests.

This has been working very good till now (I am running this from about 6 months)

What I've observed, django with mod wsgi + apache (which I used for some days earlier) was taking about 70MB of RAM after getting started (single process), and this setup uses 45MB per process or so.
Also, I've also had this with lighttpd + modfcgi which also consumes almost same amount of memory than spwaning.

(I might have miscalculated because in apache, the webserver's memory usage is also included)

You can rely on spawning, as far as I can say, but if if you don't really push often, it won't be of much use.

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