python3运行 sanic的时候报错
D:\python>python web.py
2017-01-04 00:04:56,851: INFO: Goin' Fast @ http://0.0.0.0:8000
2017-01-04 00:04:56,853: ERROR: Experienced exception while trying to serve
Traceback (most recent call last):
File "D:\software\python\lib\site-packages\sanic-0.1.9-py3.5.egg\sanic\sanic.p
y", line 304, in run
serve(**server_settings)
File "D:\software\python\lib\site-packages\sanic-0.1.9-py3.5.egg\sanic\server.
py", line 290, in serve
loop.add_signal_handler(_signal, loop.stop)
File "D:\software\python\lib\asyncio\events.py", line 475, in add_signal_handl
er
raise NotImplementedError
NotImplementedError
这是代码缩进有问题,检查一下代码
但是在运行python web的时候,还是会出问题:
网上说用:
python -m SimpleHTTPServer 8080
然而并没有什么用,因为在python3.5里面根本就没有SimpleHTTPServer
SimpleHTTPServer 被http.server替代了,所以我们应该用:
python -m http.server [<portNo>]
这个启动起来我们访问本地:
http://localhost:8080/web.py
这时候显示的都是源代码
说明我们的服务器起来了