廖雪峰老师的web开发教程中:
from aiohttp import web
def index(request):
return web.Response(body=b'<h1>Awesome!!!</h1>')
打开对应的网页总是直接弹出来下载一个文件,而不能直接在网页上展示字段Awesome!!!,后来在index函数中的body上加上以下content_type即可。
def index(request):
return web.Response(body=b'<h1>Awesome!!!</h1>',content_type='text/html')