Receiving and saving data from the Django app

Asked 2 years ago, Updated 2 years ago, 78 views

from django.shortcuts import render

from django.http import HttpResponse
# # Create your views here.

def index(request):
    num =request.GET.get("num")
    print ("num:",num)
    return HttpResponse('hello world')

This is the part that's being printed on the screen of the janggu.

I'm making a fine dust and humidity meter

I don't know how to receive and save data.

If you know it, please explain it in words.

django application io file

2022-09-22 13:49

1 Answers

First of all, I think we need to understand Janggu. As you can see in the code, request.GET communicates Restful API between the client and the server and delivers data processing through GET messages from the client through HttpResponse. Then, we need to understand what the client will be and what data the server should deliver first. If you understand based on the above, the client will be an app, and the storage will be a server. The app should communicate with Restful API, deliver the measured value (num), store it in the storage (where? DB?), process it, and deliver it back to the app

Shouldn't it be preceded first?


2022-09-22 13:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.