• bee安装并创建项目


    1.下载bee源码
    下载地址为:
    https://github.com/beego/bee

    2.解压
    将下载的文件解压到
    最后的目录如下(相应目录的需要事先创建好,解压生产的目录名为bee-develop,重命名为bee):
    ../src/github.com/beego/bee

    3.编译安装
    cd C:Gosrcgithub.comeegoee
    go build

    4.将生产的bee.exe拷贝到$GOPATH/bin

    5.查看
    C:Gosrcgithub.comeegoee>bee version
    ______
    | ___
    | |_/ / ___ ___
    | ___ / _ / _
    | |_/ /| __/| __/
    \____/ \___| \___| v1.10.0

    ├── Beego : Beego is not installed. Please do consider installing it first: https://github.com/astaxie/beego
    ├── GoVersion : go1.10.3
    ├── GOOS : windows
    ├── GOARCH : amd64
    ├── NumCPU : 8
    ├── GOPATH : C:Usershuangxuelianggo
    ├── GOROOT : C:Go
    ├── Compiler : gc
    └── Date : Monday, 9 Sep 2019

    6.创建项目
    在src目录下执行,我这里的目录是C:Usershuangxuelianggosrc
    新建一个 Web 项目,我们在命令行下执行 bee new <项目名> 就可以创建一个新的项目。
    但是注意该命令必须在 $GOPATH/src 下执行。最后会在 $GOPATH/src 相应目录下生成如下目录结构的项目.

    cd C:Usershuangxuelianggosrc
    bee new beegoprj
    C:Usershuangxuelianggosrc>bee new beegoprj
    ______
    | ___
    | |_/ / ___ ___
    | ___ / _ / _
    | |_/ /| __/| __/
    \____/ \___| \___| v1.10.0
    2019/09/09 14:18:29 INFO ? 0001 Creating application...
    create C:Usershuangxuelianggosrceegoprj
    create C:Usershuangxuelianggosrceegoprjconf
    create C:Usershuangxuelianggosrceegoprjcontrollers
    create C:Usershuangxuelianggosrceegoprjmodels
    create C:Usershuangxuelianggosrceegoprj outers
    create C:Usershuangxuelianggosrceegoprj ests
    create C:Usershuangxuelianggosrceegoprjstatic
    create C:Usershuangxuelianggosrceegoprjstaticjs
    create C:Usershuangxuelianggosrceegoprjstaticcss
    create C:Usershuangxuelianggosrceegoprjstaticimg
    create C:Usershuangxuelianggosrceegoprjviews
    create C:Usershuangxuelianggosrceegoprjconfapp.conf
    create C:Usershuangxuelianggosrceegoprjcontrollersdefault.go
    create C:Usershuangxuelianggosrceegoprjviewsindex.tpl
    create C:Usershuangxuelianggosrceegoprj outers outer.go
    create C:Usershuangxuelianggosrceegoprj estsdefault_test.go
    create C:Usershuangxuelianggosrceegoprjmain.go
    2019/09/09 14:18:29 SUCCESS ? 0002 New application successfully created!

    7.运行
    cd C:Usershuangxuelianggosrceegoprj
    C:Usershuangxuelianggosrceegoprj>bee run
    ______
    | ___
    | |_/ / ___ ___
    | ___ / _ / _
    | |_/ /| __/| __/
    \____/ \___| \___| v1.10.0
    2019/09/09 14:21:14 INFO ? 0001 Using 'beegoprj' as 'appname'
    2019/09/09 14:21:14 INFO ? 0002 Initializing watcher...
    C:Gosrcgithub.comastaxieeegologsconsole.go:23:2: cannot find package "github.com/shiena/ansicolor" in any of:
    C:Gosrcgithub.comastaxieeegovendorgithub.comshienaansicolor (vendor tree)
    C:Gosrcvendorgithub.comshienaansicolor
    C:Gosrcgithub.comshienaansicolor (from $GOROOT)
    C:Usershuangxuelianggosrcgithub.comshienaansicolor (from $GOPATH)
    2019/09/09 14:21:15 ERROR ? 0003 Failed to build the application: C:Gosrcgithub.comastaxieeegologsconsole.go:23:2: cannot find package "github.com/shiena/ansicolor" in any of:
    C:Gosrcgithub.comastaxieeegovendorgithub.comshienaansicolor (vendor tree)
    C:Gosrcvendorgithub.comshienaansicolor
    C:Gosrcgithub.comshienaansicolor (from $GOROOT)
    C:Usershuangxuelianggosrcgithub.comshienaansicolor (from $GOPATH)
    解决办法:
    下载ansicolor
    下载地址:https://github.com/shiena/ansicolor
    下载完成后解压到go path下的scr目录,我这里如下:
    C:Gosrcgithub.comshiena

    再次运行
    C:Usershuangxuelianggosrceegoprj>bee run
    ______
    | ___
    | |_/ / ___ ___
    | ___ / _ / _
    | |_/ /| __/| __/
    \____/ \___| \___| v1.10.0
    2019/09/09 14:24:33 INFO ? 0001 Using 'beegoprj' as 'appname'
    2019/09/09 14:24:33 INFO ? 0002 Initializing watcher...
    github.com/shiena/ansicolor
    github.com/astaxie/beego/config
    github.com/astaxie/beego/vendor/gopkg.in/yaml.v2
    github.com/astaxie/beego/toolbox
    github.com/astaxie/beego/utils
    github.com/astaxie/beego/grace
    github.com/astaxie/beego/vendor/golang.org/x/crypto/acme
    github.com/astaxie/beego/logs
    github.com/astaxie/beego/session
    github.com/astaxie/beego/vendor/golang.org/x/crypto/acme/autocert
    github.com/astaxie/beego/context
    github.com/astaxie/beego/context/param
    github.com/astaxie/beego
    beegoprj/controllers
    beegoprj/routers
    beegoprj
    2019/09/09 14:24:59 SUCCESS ? 0003 Built Successfully!
    2019/09/09 14:24:59 INFO ? 0004 Restarting 'beegoprj.exe'...
    2019/09/09 14:24:59 SUCCESS ? 0005 './beegoprj.exe' is running...
    2019/09/09 14:25:02.340 [I] [asm_amd64.s:2361] http server Running on http://:8080

    9.浏览器查看
    http://localhost:8080/

  • 相关阅读:
    GC原理---垃圾收集算法
    GC原理---对象可达判断
    散列算法和哈希表结构
    桶排序
    Spring事务梳理
    AQS
    重入锁
    CAS
    研究一下phpspider
    用php写爬虫去爬数据
  • 原文地址:https://www.cnblogs.com/hxlasky/p/11491587.html
Copyright © 2020-2023  润新知