首页 > 解决方案 > 如何将我的数据保存在 json 中并将其存储在数据库中(Django rest 框架)

问题描述

每次用户触摸应用程序时,我的代码输出都是 X 和 Y。我想将我所有的 Xs 和 Ys 保存在一个 json 文件中并将其存储在服务器中。我使用 Django 休息框架

   
 

  sendToServer() async{
    final res = await http.post(
      Uri.parse('http://localhost:8000/article'),
      headers: {
        "Content-Type": "application/json"
      },
      body: json.encode(allPoints)
    );
    print(allPoints);
    print(res?.statusCode);
  }
}

标签: jsonflutterdjango-modelsdjango-rest-frameworkflutter-dependencies

解决方案


推荐阅读