beego 是一个快速开发 Go 应用的 HTTP 框架,他能够用来快速开发 API、Web 及后端服务等各类应用,是一个 RESTful 的框架,主要设计灵感来源于 tornado、sinatra 和 flask 这三个框架,可是结合了 Go 自己的一些特性(interface、struct 嵌入等)而设计的一个框架。linux
go get github.com/astaxie/beego
更多安装信息:https://beego.me/docs/install/git
go get github.com/beego/bee
安装完以后,bee 可执行文件默认存放在 $GOPATH/bin 里面,因此您须要把 $GOPATH/bin 添加到您的环境变量中,才能够进行下一步,以下所示:github
(1)当前环境变量(Xshell 退出从新登陆后失效)golang
export PATH=$PATH:/home/www/golang/gopath/bin/linux_386
疑问:我这里怎么多出来一个linux_386(??) shell
(2)全局环境变量修改(Xshell 退出从新登陆后不失效)flask
sudo vim /etc/profile // 添加如下内容 export PATH=$PATH:/home/www/golang/gopath/bin/linux_386 // 编辑结束后执行 source profile 或 执行点命令 ./profile, PATH的值就会当即生效了 source /etc/profile
(3)关于 /etc/profile 和 ./profile 设置的区别vim
(4)环境变量没有安装成功的话会出现如下状况后端
bee new hello No command 'bee' found, did you mean: Command 'tee' from package 'coreutils' (main) Command 'beef' from package 'beef' (universe) Command 'ree' from package 'ree' (universe) Command 'btee' from package 'ruby-bcat' (universe) Command 'beer' from package 'gerstensaft' (universe) Command 'pee' from package 'moreutils' (universe) Command 'bbe' from package 'bbe' (universe) Command 'be' from package 'bugs-everywhere' (universe) Command 'beep' from package 'beep' (universe) Command 'see' from package 'mime-support' (main) Command 'ben' from package 'ben' (universe) Command 'bel' from package 'belier' (universe) Command 'beet' from package 'beets' (universe) bee: command not found
bee new hello
记住:要进入刚建立的新项目hello浏览器
/home/www/golang/gopath/src/hello/ www@TinywanAliYun:~/golang/gopath/src/hello$ ls conf controllers main.go models routers static tests views www@TinywanAliYun:~/golang/gopath/src/hello$ bee run
http://edu.51cto.com/center/course/lesson/index?id=24341ruby
文件目录结构
Linux 配置环境变量
export GOPATH=/home/www/golang/gopath export GOROOT=/usr/local/go export GOTOOLS=$GOROOT/pkg/tool export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Windows 配置环境变量