React + Django Data Mining App

Hi every one, Im working on a web data mining app, you should be able to upload a csv file, choose an algorithm and see the results on the browser, my problem is, that I don’t know how to create an API that only receive the csv file, handle the data with the algorithm and response with something to React. I’ve watched lots of tutorials and all of them use sqlite to store data, and I only need to process the data, is there a method just for handle data in django, when I receive the csv file, without using databases and models? or it’s strictly necessary to create a model, store csv files, and then access them locally for processing?
Thanks!

Yes, you can handle all the data directly without any user-specified models in the database. You can write a custom file upload handler that processes the uploaded file, prepares and returns a file as a response.
Note, a “file” will be created - the browser is uploading a file so something needs to be done with that data to be processed. But there’s no requirement for any of that data to be stored in the database.

1 Like

I’m completely noob in django, this is my first time using it, I read the article that you commented, but I still kind of lost, do you know an example/blog/tutorial for doing this?

Have you worked your way through the Official Django Tutorial? That’s how I recommend everyone get started.

I haven’t, I’ll check it, thanks!

Hi again, I think I understand how to invoke the api with urls, but now, am I doing it right?
with react I’m trying to send the file with fetch and post method to something llike “localhost/upload”. So, in django views.py I should do something like
def upload(request):
blabla
return Response(somethingInJsonFormat)

is this in the right way? or I missing something?

Essentially, yes - with the further clarification that there’s no direct association between the name of the view function and the url. You would have an entry in the urls.py file that tells Django where to send the request for a particular url.