这几天重新学习 Learn Python The Hard Way , 花了5~6 天时间,前前后后又学了一遍,收获很多。
遇到了这个错误:
(learn_web) for-python@ubuntu:~/mystuff/projects/gothonweb$ python2 bin/app.py
http://0.0.0.0:8080/
Traceback (most recent call last):
File "bin/app.py", line 15, in <module>
app.run()
File "/home/for-python/.local/lib/python2.7/site-packages/web/application.py", line 310, in run
return wsgi.runwsgi(self.wsgifunc(*middleware))
File "/home/for-python/.local/lib/python2.7/site-packages/web/wsgi.py", line 54, in runwsgi
return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))
File "/home/for-python/.local/lib/python2.7/site-packages/web/httpserver.py", line 148, in runsimple
server.start()
File "/home/for-python/.local/lib/python2.7/site-packages/web/wsgiserver/__init__.py", line 1753, in start
raise socket.error(msg)
socket.error: No socket could be created
真的,主要还是这些名词不熟悉,端口被占用了。
重换一个端口,python2 bin/app.py 8001
就好了:
(虚拟环境中默认使用python3,这里指定使用python2)
(learn_web) for-python@ubuntu:~/mystuff/projects/gothonweb$ python2 bin/app.py 8001
http://0.0.0.0:8001/