Mac安装 Beego 环境配置

xiaoxiao2021-02-28  61

##官网安装教程 Beego 快速入门安装教程 我在安装官网给的安装方法安装的时候遇到了点小问题,于是自己将我安装的步骤记录一下。

1.安装Go环境

2.安装或者升级Beego和Bee的开发工具

$ go get -u github.com/astaxie/beego $ go get -u github.com/beego/bee

3.添加环境变量

$ open ~/.bash_profile 在打开的文件内输入以下环境变量进行配置 export GOPATH=${HOME}/go export PATH=${PATH}:${GOPATH}/bin 然后 source ~/.bash_profile

4. 在终端输入 bee 和 go 看是否都安装成功了

go 安装成功 jiangbiaodeMacBook-Pro:~ jiangbiao$ go Go is a tool for managing Go source code. Usage: go command [arguments] The commands are: build compile packages and dependencies clean remove object files and cached files doc show documentation for package or symbol env print Go environment information bug start a bug report fix update packages to use new APIs fmt gofmt (reformat) package sources generate generate Go files by processing source get download and install packages and dependencies install compile and install packages and dependencies list list packages run compile and run Go program test test packages tool run specified go tool version print Go version vet report likely mistakes in packages Use "go help [command]" for more information about a command. --- bee 安装成功 jiangbiaodeMacBook-Pro:~ jiangbiao$ bee Bee is a Fast and Flexible tool for managing your Beego Web Application. USAGE bee command [arguments] AVAILABLE COMMANDS version Prints the current Bee version migrate Runs database migrations api Creates a Beego API application bale Transforms non-Go files to Go source files fix Fixes your application by making it compatible with newer versions of Beego dlv Start a debugging session using Delve dockerize Generates a Dockerfile for your Beego application generate Source code generator hprose Creates an RPC application based on Hprose and Beego frameworks new Creates a Beego application pack Compresses a Beego application into a single file rs Run customized scripts run Run the application by starting a local development server server serving static content over HTTP on port Use bee help [command] for more information about a command.

5. 创建 bee 项目

$ bee new beego $ cd ${GOPATH}/src $ bee run beego 看到下面的输出就证明是启动成功了 | ___ \ | |_/ / ___ ___ | ___ \ / _ \ / _ \ | |_/ /| __/| __/ \____/ \___| \___| v1.9.1 2018/07/07 18:14:54 INFO ▶ 0001 Using 'beego' as 'appname' 2018/07/07 18:14:54 INFO ▶ 0002 Initializing watcher... beego/controllers beego/routers beego 2018/07/07 18:14:56 SUCCESS ▶ 0003 Built Successfully! 2018/07/07 18:14:56 INFO ▶ 0004 Restarting 'beego'... 2018/07/07 18:14:56 SUCCESS ▶ 0005 './beego' is running... 2018/07/07 18:14:56.993 [I] [asm_amd64.s:2361] http server Running on http://:8080 2018/07/07 18:15:13.022 [D] [server.go:2694] ::1 - - [07/Jul/2018 06:15:13] "GET / HTTP/1.1 200 0" 0.003541 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 2018/07/07 18:15:13.242 [D] [server.go:2694] ::1 - - [07/Jul/2018 06:15:13] "GET /static/js/reload.min.js HTTP/1.1 200 0" 0.000292 http://localhost:8080/ Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36

6.打开浏览器输入localhost:8080打开beego主页。

社招内推

上海社招内推:java开发资深架构、web前端、ios、安卓、测试,根据职位要求,2-5年以上工作经验起,有意的私聊。

转载请注明原文地址: https://www.6miu.com/read-2628386.html

最新回复(0)