服务器拓扑帮助 - Django 和 Twisted 的可能性?

发布于 2024-11-30 18:48:43 字数 1021 浏览 0 评论 0原文

我目前正在开发一个复杂的网络界面和后端,这需要解决几个问题。

  • 可扩展性
    • 不同负载需求的多次部署
  • 非常结构化的授权组
    • 不同用户组的不同视图
    • 管理面板
      • 用户/内容管理
  • 大型托管数据库
    • 当前
    • 长期存储的数据(历史记录)
  • 数据更新
    • 投票
      • 例如。搜索查询、静态页面/文件、每个请求生成报告
    • 推送(可能是 websocket)
      • 例如。实时通知
  • 不同的协议
    • 例如。 HTTP、SSL、Websocket

我想使用 Python,因为我已经开始真正喜欢这门语言,并且我正在考虑 Django 和 Twisted 的某种组合。

我对 Django 有一些使用经验,我喜欢它的 MVT 风格的应用程序编程、授权模型、管理面板和数据库 API。但是在我需要的一些数据要求上,尤其是实时性方面,它就没有那么强了。

现在,我以前还没有真正使用过 Twisted,但我看到了很多有趣的东西。特别是异步方面以及运行许多协议的能力。

让两者协同工作的问题是显而易见的,因为 Django 是一个阻塞服务器,而 Twisted 被设计为非阻塞服务器。我看到一些主题指出将两者结合使用是可能的,并且已经取得了成功。似乎也可以运行两者并代理它们以接受不同的 url,但是通过两者进行身份验证可能会变得很棘手?

说了这么多,我想问我是否走在实施这个系统的正确轨道上,以及关于如何一起使用这两个系统的建议、替代方案,或者我是否应该剔除其中一个(在这一点上,我想它必须是 Django,因为实时的东西是必要的)。我应该提到的是,我已经在 Django 中编写了一些初步的数据模型和视图。

我在客户端(JS、CSS、HTML)方面很有经验,但在服务器端我不太懂。任何输入都会有帮助,谢谢。

I am currently working on a complex web interface and backend, that will need to address several issues.

  • Scalablility
    • multiple deployments of varying load demands
  • Very structured authorization groups
    • Different views for different user groups
    • admin panel
      • user/content management
  • Large managed database
    • current
    • long term stored data (histories)
  • Data Updates
    • Polling
      • Ex. Search queries, static pages/files, report generation per request
    • Pushing (likely websockets)
      • Ex. Real-time notifications
  • Varying protocols
    • Ex. HTTP, SSL, Websockets

I would like to use Python, because I have grown to really enjoy the language, and I am considering some combo of Django and Twisted.

I have some experience with Django, which I love for its MVT style of application programming, its authorization models, its admin panel, and its database API. However, it is not so strong in some of the data requirements that I need, in particular, the real-time aspects.

Now, I have not really used Twisted before, but I have seen many interesting things to it. In particular the async aspects, and the ability to run many protocols.

The problems in getting the two to work together are obvious in that Django is a blocking server and Twisted is designed to be non-blocking. I have seen some topics stating using the two together is possible and have had success with it. It also seems possible to run both and proxy them to accept different urls, but getting the authentication over the two may become tricky?

Having said all of that, I would like to ask if I am on the right track for implementing this system, as well as suggestions on how to use the two together, alternatives, or if I should just kick one out (at this point, I guess it'd have to be Django, because the real time stuff is necessary). I should mention that I have written some of the preliminary data models and views in Django already.

I am quite experienced on the client side of things (JS,CSS,HTML), but I am not so savvy in the server side of things. Any input would be helpful, thanks.

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

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

发布评论

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

评论(1

夏九 2024-12-07 18:48:43

You can definitely use Twisted with Django. Several projects have used the two together to good effect. twistd web --wsgi provides a basic way to get it set up, and there's a great example with more bells and whistles, like static content by Alex Clemesha on github.

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