当前位置:网站首页>梅科尔工作室-DjangoWeb 应用框架+MySQL数据库第四次培训
梅科尔工作室-DjangoWeb 应用框架+MySQL数据库第四次培训
2022-07-18 01:52:00 【不想秃头的学生】
Django项目文件梳理

django学习文档
Django 文档 | Django 文档 | Django (djangoproject.com)
前端核心代码
import qs from 'querystring'
import fetch from '@system.fetch'
export default {
data:{
winfo:"",
},
onClick(){
fetch.fetch({
url:'http://192.168.2.105:8080/',
data:qs.stringify({'id':'1'}),
responseType:"json",
method:"POST",
success:(resp)=>{
this.winfo = resp.data;
console.log("返回数据:"+this.winfo)
},
fail:(resp)=>{
this.winfo = resp.data;
console.log("获取数据失败:"+this.winfo+resp)
}
});
},
}
后端核心代码
from django.shortcuts import render
from django.http import HttpResponse
from django.shortcuts import render
from student import models
from rest_framework.views import APIView
class AppReq1(APIView):
def post(self, request):
re = models.Students.objects.filter(Age=20)//注意re不能写成request,会报错
arr = []
for i in re:
content = {'姓名': i.Name, '邮箱': i.Email, '年龄': i.Age}
arr.append(content)
print(arr)
print(type(arr))
ID = request.data.get('id')
# username = request.data.get('username')
# password = request.data.get('password')
print(ID)
# print(username)
# print(password)
return HttpResponse(arr)个人总结:有点难学习,还需要认真学习总结练习
边栏推荐
- Expressions régulières MySQL
- Stm32+a4988 control stepper motor
- Read the paper: temporary graph networks for deep learning on dynamic graphs
- 总结阅读器与直播的奇怪交互:复习双迪技术
- 二手房房价分析与预测(图表绘制避免中文乱码、饼形图、折线图、条形图(柱形图)、enumerate函数、数据清洗(lambda\map)、二手房预测(scikit-learn))
- CH549/CH548学习笔记6 - 读取芯片ID
- 概率论与数理统计
- openresty ngx_ Lua shared memory
- 力扣 565. 数组嵌套
- Ch549/ch548 learning notes 1 - hardware design
猜你喜欢

flask 视图

CH549/CH548学习笔记3 - UART

Alibaba cloud OSS mapping method

CH549/CH548学习笔记8 - USB Device中断处理

Deep learning environment configuration pytoch

奥扬科技IPO被终止注册:年营收8亿 苏伟持有67.5%股权

Cause analysis of the red light of the server and soft switch status on the Vos client

Ugui source code analysis - rectmask2d

对象内存布局和synchronized锁升级

Ch549/ch548 learning notes 3 - UART
随机推荐
新股民如何网上开户,网上开户安全吗?
总结阅读器与直播的奇怪交互:复习双迪技术
UGUI源码解析——RectMask2D
openresty ngx_lua共享内存
Read the paper: temporary graph networks for deep learning on dynamic graphs
The solution that Google browser chrome cannot be upgraded
openresty lua-resty-lrucache缓存
MySQL 正则表达式
MySQL - 表字段的唯一键约束
支付宝上怎么买基金,安全吗
Is it safe to open a fund account online? College students seek guidance
How to buy funds on Alipay? Is it safe
思必驰冲刺科创板:年营收3亿亏3.4亿 阿里与联想之星是股东
Deep learning environment configuration pytoch
Is online fund account opening safe? Find the answer online
Ch549 / ch548 notes d'apprentissage 9 - procédure de traitement des paramètres du périphérique USB
模板的初识
Basic use of anaconda and its use in pychart
使用 QuickExec fiddler命令行
MySQL - default value constraint for table fields