python 使用 django 并扭曲在一起
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2099189/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
using django and twisted together
提问by user223541
1)I want to devlop a website that has forums and chat.The chat and forums are linked in some way.Meaning for each thread the users can chat in the chat room for that thread or can post a reply to the forum.
I was thinking of using django for forums and twisted for chat thing.Can i combine the two?
The chat application devloped using twisted is linked to the forum.
1)我想开发一个有论坛和聊天的网站。聊天和论坛以某种方式联系在一起。这意味着对于每个话题,用户可以在该话题的聊天室中聊天,或者可以在论坛上发表回复。我正在考虑将 django 用于论坛并扭曲用于聊天。我可以将两者结合起来吗?使用twisted 开发的聊天应用程序链接到论坛。
2)If i use twisted and django what kind of web host shold i use while putting by website on web ?Shold i use a VPS? Or can i get a host that supports both?
2)如果我使用twisted 和django,我使用什么样的网络主机,同时将网站放在网络上?我使用VPS?或者我可以获得支持两者的主机吗?
回答by Ignacio Vazquez-Abrams
I would not combine the two per se; calls into Django would happen synchronously which means that Twisted's event loop would be blocked. Better to treat the Twisted process as a standalone app using Djangoand to have a classic web server handle the Django app.
我不会将两者结合起来。对 Django 的调用将同步发生,这意味着 Twisted 的事件循环将被阻止。最好将 Twisted 进程视为使用 Django的独立应用程序,并让经典的 Web 服务器处理 Django 应用程序。
You are not likely to find a shared host that will allow you to run a Twisted app, so I would go the VPS route.
您不太可能找到允许您运行 Twisted 应用程序的共享主机,因此我会选择 VPS 路线。
回答by clemesha
I have a project going that might be just what you are looking for (at least to get started). It is called Hotdot: http://github.com/clemesha/hotdot.
我有一个项目可能正是您正在寻找的项目(至少是开始时)。它被称为 Hotdot:http://github.com/clemesha/hotdot 。
Also, I wrote up more details about this topic here: http://clemesha.org/blog/2009/dec/17/realtime-web-apps-python-django-orbited-twisted/
另外,我在这里写了关于这个主题的更多细节:http: //clemesha.org/blog/2009/dec/17/realtime-web-apps-python-django-orbited-twisted/
回答by kolen
If forum application needs to get something from chat application, it's simplier to make forum application communicate with chat application with plain HTTP requests and to make them run separately.
如果论坛应用程序需要从聊天应用程序中获取一些东西,那么让论坛应用程序与聊天应用程序通过普通的 HTTP 请求进行通信并让它们单独运行会更简单。