摘要:
用 json 模块和 HttpResponse 返回生成的 json views.py: from django.shortcuts import render, HttpResponse import json # json 测试 def json_test(request): data = {" 阅读全文
摘要:
request.method: 获取请求的方法,例如 GET、POST 等 views.py: from django.shortcuts import render, HttpResponse # request 对象 def test(request): print(request.method 阅读全文
摘要:
FBV: Function Base View,基于函数的视图 views.py: from django.shortcuts import render, HttpResponse # FBV def upload(request): if request.method == "POST": fi 阅读全文
摘要:
upload.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>上传页面</title> </head> <body> <form action="/upload/" method="post" e 阅读全文