版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yang731227/article/details/82251649
Beego的安装
-
配置环境变量
上一章说过Beego是基于go语言的快速开发框架,且作者设定了新项目只能生成在$GOPATH/src目录下,所以我们必须要配置好GOPATH 和GOROOT。GOROOT位置是go编译器所在位置,GOPATH是我们的工作目录,一般用来新建项目。
因为Beego的作者为我们提供了一个自动化工具bee,所以我们还需要设置下Path,我们需要在Path添加%GOROOT%\bin也可以写为C:\Go\bin
-
从github安装Beego
使用go get命令安装beego文件
go get github.com/astaxie/beego
安装bee工具
go get github.com/beego/bee
都安装好后,我们可以在CMD输入bee,可以看到如下的信息:
Bee is a tool for managing beego framework.
Usage:
bee command [arguments]
The commands are:
new create an application base on beego framework//创建一个新的beego应用
run run the app which can hot compile //运行编译程序
pack compress an beego project //打包一个编译好的项目
api create an api application base on beego framework //创建一个API应用框架
bale packs non-Go files to Go source files
version show the bee & beego version //查看beego版本
generate source code generator //生成源代码
migrate run database migrations //运行数据库迁移
如果“出现'bee' 不是内部或外部命令,也不是可运行的程序”,则表示安装失败了。这时候我们首先查看环境变量是否设置好,如果环境变量没有问题 。打开浏览器访问github 看是否被墙了。