Django and Node-red


Hi, my question is this:
Is it possible to commit Django and Node-red together all acting on one database?

Short description of my project.

I want to set up a smart meter for a company that supplies water.
To do this, I've decided to create a django project with the necessary database and I want to set up a dashboard on Node-red to display the data in real time and update the database in real time.
So I want every logged-in user to be able to go to their dashboard to see their consumption by just clicking on the link.
How do I do this?

Version originale en Français

Salut, ma question est la suivante:
Est t-il possible de comminuquer Django et Node-red ensemble agissant tous sur une base de données?

Petite description de mon projet.

je veux mettre en place un compteur intelligent pour une entreprise fournisseuse d'eau.
Pour se faire, j'ai decidé de créer un projet django avec la base de données neccessaire et je veux mettre en place un tableu de bord sur Node-red pour reprensenter les données en temps reel et mise à jour de la base en temps réel.
Donc je veux pour chaque utilisateur connecté peut se rendre sur son tableau de bord pour voir ses consommations en cliquant juste sur lien.
Comment le faire?

Salut @Hamadysaka, bienvenue.

Node-red dashboard is essentially single user. There is no simple way to display different data on different users' dashboards.
It may be possible with alternative dashboards such as uibuilder, or maybe you should look at Node-red's bigger brother FlowForge

1 Like

Django is a Python web framework. Node-RED is a node.js web framework (sort-of). So using them together is unlikely to be the most efficient. Certainly, as others have said, Node-RED Dashboard is unlikely to play nicely with Django since it is firstly not multi-user aware and secondly uses the old AngularJS v1 front-end framework.

If you want to use Django because you already have your identity and access management set up through it then most likely, the best approach would be to make use of Node-RED just as an API server for getting data in and out of your database, the meter device data and making the data available to Django back-end.

1 Like

if I understand correctly, you mean that the Node-red dashbord is not multi-user. And how I can take advantage of Node-red(like Node-red dashbord graphs).
Any advice as I really want to use django too

Node-red Dashboard graphs are fairly limited in that you really need to control them carefully to ensure they don't bring the users browser to its knees. But in any case, Dashboard is driven by Node.js (which is what Node-RED runs on) and uses AnglularJS v1 (now at end of life) so totally different to Django.

Django has its own tooling for charts (ref) and would need to either connect to an intermediate DB (almost certainly the best method) or to MQTT as a message queue to transfer data from the Node-RED side to the Django side.

By using Node-RED to manage the data from the IoT devices to the db and using Django tools to get the data from the DB, you would likely have the best compromise to using both tools.

Or you could use Django to provide your general web site and IDM then embed Node-RED web outputs (either Dashboard if its limitations meet your needs or an alternative like uibuilder if you need more flexibility) as non-native web pages into the Django CMS.

In theory, you could also use Django as the web server for uibuilder integration. uibuilder gives a direct, 2-way data channel between Node-RED and client browsers. The uibuilder client library can be served from outside Node-RED, you need to tell the browser the correct connection parameters but then it works the same as running it natively from Node-RED. But uibuilder doesn't give you all the pre-built stuff that Dashboard does (yet).

1 Like