News for hackers. Stuff that matters.
Re:Ginger Tech Stack (Realtime + Django) by waterside81 on Monday April 23, 2012 @03:19PM (#3880481)
What hit me about this article is that I employ almost an identical stack and have never really stepped back and taken a look at just how many pieces are required to make a non-trivial web app. When you're working with these tools day-in, day-out, you get almost institutionalized and forget the complexities that you've absorbed over the years.

A side note: it's a testament to the great work the open-source community has put in over the past decade (two decades?) or so that so many pieces can come together and work relatively seamlessly.

Re:Ginger Tech Stack (Realtime + Django) by clivestaples on Monday April 23, 2012 @12:33PM (#3879645)
Very interesting. I was agonizing over the weekend about which stack to use for a new project. I know Rails really well, but Express/Node.js is so hard to ignore these days. This solution seems like the best of both worlds, but I'm still not sure how it works:

In the described scenario, Django loads to initial page with the Backbone.js/Socket.IO code and Django continues to handle all post/put/deletes while Socket.IO delivers all the "get" requests via web sockets?

Re:Ginger Tech Stack (Realtime + Django) by ipmb on Monday April 23, 2012 @12:45PM (#3879703)
Yeah, I think you've got it.

1. Initial page load dumps in as much data as possible to get things started.

2. All writes go through the Django API (we just look for a success/fail response).

3. All new/real-time data gets pushed to the client via socket.io. This includes data that you yourself created.

#1 is kind of a given, but #2 & #3 are more personal preference/app-specific I think.

We could have done #2 through socket.io, but as noted in the post, Python is our primary language and we wanted to push as much of the logic to it as we could.

At first we had content creators reading responses from the API with all other team members getting their updates from socket.io. This was problematic because creators would get content twice (once over the update channel for the team and once from the API). It resulted in some strange race conditions and a lot of "have I already received this message?" code. In the end, it was easiest for us to just always defer to the data from the socket (which was faster as well).

Re:Ginger Tech Stack (Realtime + Django) by amackera on Monday April 23, 2012 @03:57PM (#3880641)
What is your system for pub/sub from the client's perpective? Do you have matching models on Backbone & Django?

I guess what I'm interested in is how to know what users to route what data to via socket.io.

Great stack! We use something very similar.

Re:Ginger Tech Stack (Realtime + Django) by ipmb on Tuesday April 24, 2012 @09:05AM (#3883720)
The client passes a unique key with a short TTL to the Node.js server that maps them to the proper user and teams for the duration of their session.
Re:Ginger Tech Stack (Realtime + Django) by clivestaples on Monday April 23, 2012 @12:52PM (#3879752)
This makes a lot of sense and I look forward to trying this out in my own project. Thanks.
Re:Ginger Tech Stack (Realtime + Django) by danneu on Tuesday April 24, 2012 @01:01PM (#3884947)
I'm too am comfortable with Rails and the Ruby ecosystem but jumped into Express recently with Socket.io and MongoDB and think you should too. My curiosity was shortly satisfied and I decided to stick with synchronous code instead dealing with callbacks. For a moment there, I was high with "I'll use Node with everything!".

But the experienced inspired me to play with Ruby's EventMachine, Cramp, Goliath, and implementations like socketio-ruby on Cramp. I also took some time out of my life to really dive in to Javascript and experience some new tools.

Re:Ginger Tech Stack (Realtime + Django) by swah on Tuesday April 24, 2012 @12:21PM (#3884659)
Is using a queue for calling Node.js the better/proper thing to do here? I thought this was the exact use case of Thrift.

Thanks for the post, I wish more companies would describe their stack at least in a high-level way, so we can know what is working "in production".

Re:Ginger Tech Stack (Realtime + Django) by neilk on Monday April 23, 2012 @01:45PM (#3880017)
I saw the Ginger video demo, where is any real-time functionality needed?
Re:Ginger Tech Stack (Realtime + Django) by ipmb on Monday April 23, 2012 @01:50PM (#3880042)
As the product evolved, the real-time needs (surprisingly) became less than we originally expected. I think this will change as we continue to evolve.

That being said, after the initial page load, almost everything happens without a page refresh or full page load. You see new messages (with favicon notification), votes, unread counts, etc. all in real-time. I think Ginger would feel a lot klunkier without the real-time bits.

Re:Ginger Tech Stack (Realtime + Django) by lopatin on Monday April 23, 2012 @01:50PM (#3880039)
There were real time discussion updates in the video
Re:Ginger Tech Stack (Realtime + Django) by Alexandervn on Monday April 23, 2012 @01:15PM (#3879863)
Have you considered Mongrel2 or ZeroMQ for your stack?
Re:Ginger Tech Stack (Realtime + Django) by ipmb on Monday April 23, 2012 @01:20PM (#3879891)
Not much more than a cursory look. It sounds like they aim to solve some of the technical challenges we encountered though.
Re:Ginger Tech Stack (Realtime + Django) by frankwiles on Monday April 23, 2012 @01:15PM (#3879861)
Looks great, congrats on the launch Pete!
Re:Ginger Tech Stack (Realtime + Django) by ipmb on Monday April 23, 2012 @01:18PM (#3879881)
Thanks Frank! I certainly can't take the credit though. Almost everyone on our team (http://lincolnloop.com/about/) has committed to the project repo.
Re:Ginger Tech Stack (Realtime + Django) by bdr on Monday April 23, 2012 @02:23PM (#3880208)
Did you try tornadio2?
Re:Ginger Tech Stack (Realtime + Django) by sciurus on Monday April 23, 2012 @05:41PM (#3881124)
This is the first time I've heard of tornadio2; it turns out there is a list of other socket.io server implementations at https://github.com/learnboost/socket.io/wiki/
Re:Ginger Tech Stack (Realtime + Django) by ipmb on Monday April 23, 2012 @02:27PM (#3880230)
AFAIK it was released after we settled on Node.js.
Re:Ginger Tech Stack (Realtime + Django) by garindra on Monday April 23, 2012 @07:08PM (#3881471)
We use Tornadio2 along with Pika (with the IOLoop sharing) for an internal project and it's been great.
Re:Ginger Tech Stack (Realtime + Django) by zaidos on Monday April 23, 2012 @01:05PM (#3879810)
This stack has no soul.
Re:Ginger Tech Stack (Realtime + Django) by younata on Monday April 23, 2012 @09:07PM (#3881908)
I get that you want to make a joke.

I also think you need to understand it's not a joke. The fact that there exists "kick a ginger day" [0] is proof that it's not a joke. Abuse is not funny, ever.

[0] http://laist.com/2009/11/24/kick_a_ginger_day_spawned_at_lea...

Re:Ginger Tech Stack (Realtime + Django) by whalesalad on Monday April 23, 2012 @01:22PM (#3879905)
This made me chuckle. Unfortunately most of the people on HN will probably take it the wrong way.