Merge branch 'master' of http://git.zjvtit.net/21653B118/demo
This commit is contained in:
commit
de158d9f3f
|
@ -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()
|
Loading…
Reference in New Issue