视图和装饰器-1
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse,HttpRequest
|
||||
|
||||
# Create your views here.
|
||||
def t1(resquest:HttpResponse):
|
||||
print(resquest.method)
|
||||
return HttpResponse('function response ok!')
|
||||
|
||||
content = """"
|
||||
<html>
|
||||
<head><title>zhibang</title></head>
|
||||
<body>
|
||||
我是案例2
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
## 动态生成网页
|
||||
def t2(request):
|
||||
return HttpResponse(content)
|
||||
|
||||
## 静态网页
|
||||
def t3(request):
|
||||
with open(r'D:\python_project\pythonProject\user\test.html', 'rb') as f:
|
||||
return HttpResponse(f.read())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user