Node-RED and Django?

We can use Node-RED with Django in the future?

I’m afraid I’m going to need slightly more context than that. In what way do you want to connect Django to Node-RED? Run the editor embedded in a Django application? Perhaps use a Django frontend as dashboard replacement? Send messages to/from Django?

Can you explain a bit more about your situation and use case, so we can understand what your question is?

I’m using a Python stack for most of my applications (though Flask in general rather than Django), and to communicate with Node-RED my current concepts/designs use MQTT to communicate between both.

I want to use Node-RED features with the Django project. I saw the Pythonic project and I ask here about how can be done this issue. Thank's.

Can you specify what you mean with “the pythonic project”? I’m assuming it’s not the PyPI library pythonic? Are you referring to a specific node-red-contrib node? As for the python3 function node that was posted about this week, it appears to not be maintained, and it is supposed to allow a special function node to be programmed through Python3 code rather than JavaScript.

However, that wouldn’t be very efficient to use Django code with, seeing how Django is a batteries included server framework, and these nodes are for scripting Node-RED.

And it only calls exec on the function anyway which is particularly inefficient, there are better node.js libraries that could be used I believe and that would be more efficient in being able to communicate back and forth with Node-RED.

In my current prototypes if I need to communicate between a python application or web server on one side, and node-red on the other I add MQTT communication to the mix. I’m already using MQTT as main interface to connect the speech control setup to NR.

If you would like to use NR to run/connect to tasks on Django through Celery, I read that there was a possibility to use MQTT on the AMQP base. For a previous proof of concept/prototype I only had a free Atlas tier of MongoDB available and used the discontinued mongodb broker/backend to create a setup that worked with newer versions of Celery/MongoDB just fine. If needed, the same could be done for MQTT as well.

With a setup like that, NR and other incoming signals (for example sensor data) can be used to send out tasks through Celery (over MQTT), which are executed on the Django stack.

But in the end it all depends on your exact question and goals, and speculating about all possibilities might not be too helpful :slight_smile:

So the question, better formulated than earlier, remains as this:

  1. What do you want to do with Django?
  2. What do you want to do with Node-RED?
  3. What kind of communication between these two do you imagine?
1 Like