简体   繁体   English

使用 django 处理来自 React.js 表单的数据

[英]Processing data from React.js form with django

I create a web application using Django for the back-end and React for the front-end.我创建了一个 web 应用程序,后端使用 Django,前端使用 React。 I have three input forms on my HTML page, which I create with react.我的 HTML 页面上有三个输入 forms,这是我用 React 创建的。 I need to send this data to MySQL.db and processing using.py script.我需要将此数据发送到 MySQL.db 并使用 .py 脚本进行处理。 Can you explain, how can I send data from react to django你能解释一下,我怎样才能将数据从 react 发送到 django

With react, we mostly fetch data and show it as HTML, and that data is fetched by a web-based API, which just looks like a URL. so if you want to send data to Django must create an API with Django-rest-framework and it's very easy.使用 React,我们主要获取数据并将其显示为 HTML,并且该数据由基于 Web 的 API 获取,它看起来就像 URL。因此,如果您想将数据发送到 Django,则必须创建一个 API 和 8837's8485450简单的。 You will need to send data to that API and it will add that to your database.您需要将数据发送到该 API,它会将其添加到您的数据库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM