将 Node.js 与 Django 和 Backbone.js 结合使用
一些背景:我计划构建一个以 Django 作为后端并使用 Backbone.js 作为前端 Javascript 框架的应用程序。它是一个单页应用程序 (SPA),这就是我决定使用 Backbone.js 的原因。该应用程序类似于博客引擎;用户发布包含文本和图像的条目,并可以通过“标签”查看它们。他们可以通过“标签”或特定单词搜索条目。
最近,在听到有关 Node.js 的所有争论后,我想知道它如何帮助我的应用程序。但我不想让应用程序在后端纯粹运行在node.js上,即我仍然希望使用Django作为后端。是否可以使用 Node 作为“中间端”,如前面提到的 这里?
如何使用 Node.js 优化我的应用程序?
Some background: I am planning to build an application with Django as the backend and using Backbone.js as the frontend Javascript framework. It is a Single page application (SPA) and this is the reason I decided to use Backbone.js. The application is similar to a blogging engine; users post entries containing text and images and are able to view them by "tag". They can search through their entries by "tag" or by a particular word.
Lately, after hearing about all the fuss about Node.js, I am wondering how it can help my application. But I don't want to make the app run purely on node.js on the backend, i.e., I still wish to use Django for the backend. Would it be possible to use Node for the "middle end" as mentioned here?
How can I optimize my app with Node.js?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您的应用程序不一定需要 Node.js。除了 Django 或 Rails 等更传统的框架之外,您可能还想使用 Node 的主要原因是您的应用程序是否具有实时或多人游戏方面。
我不会使用 Node.js,因为它有很多大惊小怪 - 不过,如果您需要上述功能,它可能会很棒。
您的应用程序的高级架构可能类似于:
Django
Backbone
Node(可选)
It sounds like your application does not necessarily need Node.js. The main reasons you might want to use Node in addition to a more traditional framework like Django or Rails is if there is a real time or multiplayer aspect to your application.
I wouldn't use Node.js because there is a lot of fuss about it - if you need the aforementioned functionality, though, it can be great.
A high level architecture of your application might look something like:
Django
Backbone
Node (Optional)
如果您总体上对 python 和 Django 感到满意,我建议使用像 Tornado 这样的 Web 服务器。如果您熟悉 Django,它非常容易使用,并且学习曲线很陡。一般来说,您会看到性能改进,并且能够实现其他“模糊”功能,例如 Comet 编程。
至于前端,是的,Backbone 是一个很好的选择,但也要关注 Coffeescript...
If you feel comfortable with python and Django in general, I'd recommend using a web server like Tornado. It is very easy to use and has a steep learning curve if you're familiar with Django. In general, you'll see performance improvements and you'll have the ability to implement otherwise "obscure" functionality, like Comet programming.
As for the frontend, yes, Backbone is an excellent choice, but keep an eye on Coffeescript too...