This commit is contained in:
qwer_poiuy 2021-12-24 09:11:32 +08:00
commit de158d9f3f
2 changed files with 31 additions and 0 deletions

0
README.md Normal file
View File

31
www/app.py Normal file
View File

@ -0,0 +1,31 @@
import logging; logging.basicConfig(level=logging.INFO)
# logging是Python 的日志记录工具level表示设置根记录器级别去指定 level.
# 日志级别:
# CRITICAL 50
# ERROR 40
# WARNING 30
# INFO 20
# DEBUG 10
# NOTSET 0
# 导入 logging 模块并使用';'对其全局配置
# basicConfig 配置了 level 信息level 配置为 INFO 信息,即只输出 INFO 级别的信息
import asyncio
from aiohttp import web
async def index(request):
return web.Response(body=b'<h1>fuck</h1>', headers={'content-type': 'text/html'})
def init():
# 创建 web.Application ,web app的骨架
app = web.Application()
app.router.add_get('/', index)
web.run_app(app, host='127.0.0.1', port=9000)
if __name__ == '__main__':
init()