Using Django with MongoDB and Socket.IO

I want to build a Social Media Website like Facebook, and I want to use Django for my backend.

But People are saying many things that makes me unsure if Django is the right choice.

1.) They say Django is now Old School, and too opinionated. For example it works with PostgreSQL and will not work with Document Database like MongoDB.

2.) For Asynchronous functions where we use Web Sockets like Socket.IO for instantaneous notifications and messaging, they say Django falls short of this fluidity and will not be effective compared to a tool like Node.JS combined with Socket.IO

Are these 2 claims true against Django? And are there ways to make these features possible with Django as a backend?

False. See MongoDBs docs on the topic - Django Integration With MongoDB Tutorial | MongoDB

Partly true. Django itself does not support websockets. You would need to implement something like Channels, which does integrate nicely with Django. Or, you could implement an external connector using NodeJS / Socket.IO and integrate the two.

@ [KenWhitesell]
Thanks very much for this answer.
At least it cleared some of my doubts. So it means I can do Web Sockets in Django using the Channels Layer?

Does this mean that with Channels, I can integrate in my project?


I hesitate to answer this with a direct “yes”/“no” because my opinion is that the answer is a little more nuanced than that. Part of the difficulty with an answer is that “Django” is not one thing. It is a collection of modules all working together. Some of those modules make sense with websocket connections (such as the ORM), some don’t. (e.g. HttpRequest and HttpResponse objects)

I’ll start by saying that I would phrase my answer as “Channels allows you to use websockets in a Django environment.” The types of things you do with websockets is, from a certain perspective, fundamentally different than what you do with Django.

Socket.IO is a higher-level protocol that runs on top of websockets (among others), and provides other features as well.

You could implement the server-side of the protocol in Channels, but the protocol isn’t particularly well defined and subject to being changed at-will. The only way to really understand how it functions is to reverse-engineer it from the JavaScript code. (Then you still have the issue of implementing it within Channels.)

Unfortunately, the only truly reliable server-side implementation is the official Node.js implementation.