beego安装

144 阅读1分钟

Go环境搭建

  • GOROOT:go的安装路径
  • GOPATH:go的工作目录,包含srcpkgbin等文件
$ go version
go version go1.22.0 windows/amd64

beego和bee

Windows下离线安装

我的Go安装在D:\go

通过压缩包方式下载并解压

github.com/astaxie/bee…

github.com/beego/bee

  • 解压beego.zip,进入beego,然后把beego-dev改名为beego

  • 解压bee.zip,进入bee,然后把bee-dev改名为bee

  • D:\go\src下新建github.com

  • 然后在D:\go\src下新建astaxie,然后把刚才的解压的beego文件放到astaxie下面。D:\go\src\github.com\astaxie\beego

  • 然后在D:\go\src下新建beego,然后把刚才的解压的bee文件放到beego下面。D:\go\src\github.com\beego\bee

  • 然后在D:\go\src\github.com\beego\bee下执行go build,如果失败修改镜像源。

  • D:\go\src\github.com\beego\bee下会生成一个bee.exe,把它放到D:\go\bin里面

admin@ZLHJJ-20230316X MINGW64 /d/go/src/github.com/beego/bee
$ bee version
2024/05/18 21:24:18.444 [D]  init global config instance failed. If you do not use this, just ignore it.  open conf/app.conf: The system cannot f
ind the path specified.
2024/05/18 21:24:19 INFO     ▶ 0001 Getting bee latest version...
2024/05/18 21:24:20 INFO     ▶ 0002 Your bee are up to date
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.1.0

├── GoVersion : go1.22.0
├── GOOS      : windows
├── GOARCH    : amd64
├── NumCPU    : 8
├── GOPATH    : C:\Users\admin\go
├── GOROOT    : D:\go
├── Compiler  : gc
└── Date      : Saturday, 18 May 2024

admin@ZLHJJ-20230316X MINGW64 /d/go/src/github.com/beego/bee
  • bee new demo
  • cd demo然后go mod tidy然后bee run
$ bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v2.1.0
2024/05/18 21:56:40 WARN     ▶ 0001 Running application outside of GOPATH
2024/05/18 21:56:40 INFO     ▶ 0002 Using 'demo' as 'appname'
2024/05/18 21:56:40 INFO     ▶ 0003 Initializing watcher...
demo/controllers
demo/routers
demo
2024/05/18 21:57:18 SUCCESS  ▶ 0004 Built Successfully!
2024/05/18 21:57:18 INFO     ▶ 0005 Restarting 'demo.exe'...
2024/05/18 21:57:18 SUCCESS  ▶ 0006 './demo.exe' is running...
2024/05/18 21:57:21.393 [I] [server.go:281]  http server Running on http://:8080
2024/05/18 21:58:04.456 [D] [router.go:1305]  |      127.0.0.1| 200 |    45.4586
ms|   match| GET      /     r:/
2024/05/18 21:58:04.532 [D] [router.go:1305]  |      127.0.0.1| 200 |     2.3739
ms|   match| GET      /static/js/reload.min.js

image.png