[英]Python http.server not print log
我正在使用Git Bash運行一個帶有$ python3 -m http.server 8000的簡單本地服務器
Git Bash從不打印它正在運行,也沒有得到請求的日志。 我可以訪問http:// localhost:8000 /所以該命令正常工作。 如何讓git bash打印日志?
這似乎是mingw下線緩沖的一般問題。 您應該能夠通過避免緩沖輸出來解決這個問題,在您的情況下可以通過緩沖輸出
$ python -u -m http.server 8080
這按預期工作
$ uname -a
MINGW64_NT-6.3 - 2.5.0(0.295/5/3) 2016-03-31 18:47 x86_64 Msys
從看看“什么”Git Bash,它似乎是cygwin的縮減版本。 我剛剛運行“python3 -m http.server 8000”,並獲得以下日志輸出:
$ python3 -m http.server 8000
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [04/Jun/2017 20:15:10] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/Jun/2017 20:15:10] code 404, message File not found
127.0.0.1 - - [04/Jun/2017 20:15:10] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [04/Jun/2017 20:15:10] code 404, message File not found
127.0.0.1 - - [04/Jun/2017 20:15:10] "GET /favicon.ico HTTP/1.1" 404 -
似乎git bash沒有正確記錄(輸出)。
嘗試在virtualbox / vagrant中運行“python3 -m http.server 8000” - >使用Ubuntu或Centos。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.