How can I get the data from a POST request using Plotly Dash Callbacks function. Django

I’m working with node js and django data connection. I have this middleware using node js that can send data using post request

my node.js

const payload = mydata;
        //POST payload to django
        var obj = { data: payload };
        jsonobj = JSON.stringify(obj);
        var XMLHttpRequest = require("xhr2");
        var xhr = new XMLHttpRequest();"POST", "", true);
        xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");

And I can access that data in my django project using this following code. It’s printing the data that node js sent.

from django.views.decorators.csrf import csrf_exempt
import json

def overview(request):
    if request.method == 'POST':
    post_data = json.loads(request.body.decode("utf-8"))
    value = post_data.get('data')

    return render(request, 'myhtml')

In my

from iot import views as iotviews

urlpatterns = [
    path('path/', iotviews.overview),

now, I’m trying to use the data in my Plotly Dash. I’m going to use the data to generate a graph. But it’s not working unlike in

app = DjangoDash("SimpleExample")
    app.layout = html.Div([
        html.Div(style={'display': 'flex'}, children=[
                    'data': [
                        {'x':  [],
                         'y': [],
                    'layout': {
                        'title': 'pH (pH)',
    @app.callback(Output('graph-ph', 'figure'),
                  [Input('interval-graph-update', 'n_intervals')],
                  [State('graph-ph', 'figure')])
        def update_extend_traces_traceselect(n_intervals, fig_raw, request):
            if request.method == 'POST':
                post_data = json.loads(request.body.decode("utf-8"))
                value = post_data.get('data')
if "SimpleExample" == '__main__':

I think I can’t use request as an argument to every function in django. It has to be a view function. If it is a regular function, it will not recognize request. Is there another way to get the data?

How are you calling it? (What is calling update_extend_traces_traceselect?)

And what do you mean by “a regular function”? The Django view you showed (overview) is “a regular function”.

Hello, I updated my post Sir.

If you’re not accepting the POST request in a Django view, how is this related to Django?

It seems to me that this is a Dash issue - you may get better, faster, more accurate assistance in a Dash-oriented support forum. (There might be people here familiar with Dash that can try to help, but from what I can tell, this isn’t a Django issue.)