27 lines
547 B
Python
27 lines
547 B
Python
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())
|
|
|
|
|