基于golang快速搭建后台管理中心

cg33 3a08fe0034 update to v1.2.7 il y a 6 ans
tables f6906b91ce fixed error il y a 6 ans
uploads 28b7348618 add upload il y a 6 ans
vendor 3a08fe0034 update to v1.2.7 il y a 6 ans
.gitignore 9b76c5912c update dependency il y a 6 ans
Dockerfile 2001ab86b4 add dockerfile il y a 6 ans
Makefile 702555dd8a modify vendor and go.mod il y a 6 ans
README.md 3a08fe0034 update to v1.2.7 il y a 6 ans
admin.db 5f10eb9cb4 initial il y a 6 ans
config.json f38cf13f87 modify example main.go, make more clear il y a 6 ans
go.mod 3a08fe0034 update to v1.2.7 il y a 6 ans
go.sum 3a08fe0034 update to v1.2.7 il y a 6 ans
index.go 7d45043641 update example il y a 6 ans
main.go 3a08fe0034 update to v1.2.7 il y a 6 ans
main_test.go 3a08fe0034 update to v1.2.7 il y a 6 ans

README.md

GoAdmin Example

A example show how to run go-admin. Just for reference, here to know more.

Following three ways to run the code.

If you are Windows user, go-sqlite-dirver require to download the gcc to make it work.


一个运行go-admin的例子。仅供参考,在这里了解更多。

以下三种方法。建议go版本大于1.11使用模块加载,同时设置环境变量GOPROXY=http://goproxy.cn,版本低于1.11的盆友使用第二种方法。如果本机没有golang环境,可以使用docker。

如果你没有golang基础,是golang新手的话,建议花几分钟了解一下golang的依赖包管理机制

如果你是windows用户,那么你需要下载gcc,因为本例子使用的是sqlite数据库,如果你不想使用sqlite数据库,你可以换成mysql,则不需要下载gcc。

use go module 使用模块加载依赖

To use go module, you should set GO111MODULE=on first.

使用 go module的话,需要先设置环境变量GO111MODULEon

step 1

git clone https://github.com/GoAdminGroup/example.git

step 2

cd example
GO111MODULE=on go run .

visit: http://localhost:9033/admin

use gopath 使用GOPATH加载依赖

To use go path, you should set GO111MODULE=off first.

使用 go path的话,需要先设置环境变量GO111MODULEoff

step 1

git clone https://github.com/GoAdminGroup/example.git

step 2

go get github.com/kardianos/govendor
cd example
govendor sync

如果你在中国,因为各种原因导致用以上步骤进行下载安装依赖有问题,那么你可以直接从这里下载:vendor.zip

下载完解压到项目文件夹即可。

step 3

go run .

visit: http://localhost:9033/admin

use docker 使用docker

step 1

git clone https://github.com/GoAdminGroup/example.git

step 2

cd example
docker build -t go-admin-example .

step 3

docker attach $(docker run -p 9033:9033 -it -d go-admin-example /bin/bash -c "cd /go/src/app && GOPROXY=http://goproxy.cn GO111MODULE=on go run .")

visit: http://localhost:9033/admin