测试环境:python
系统: CentOS 7.1
Mem: 8G
CPU: 虚拟机16核
Python版本: python3.6
Flask版本: 0.12.2
Golang版本: 1.6.3
1.首先写一个Flask的web程序,只返回一个 Hello word!
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello word!'
if __name__ == '__main__':
app.run()
2.写一个go语言的web程序,也返回一个 Hello word!
package main
import (
f "fmt"
"log"
"net/http"
)
func sayhelloName(w http.ResponseWriter, r *http.Request) {
f.Fprintln(w, "hello world!")
}
func main() {
http.HandleFunc("/", sayhelloName)
err := http.ListenAndServe(":8080", nil)