Revel框架安装

官网:http://revel.github.io/tutorial/index.html

中文社区:http://www.gorevel.cn/

一、安装Revel框架

下载Revel框架源码,将其源码放入%GOPATH%src/github.com/revel/revel目录下,然后在%GOPATH%src目录下进行编译操作:

编译:go build github.com/revel/revel

结果报错,如下:

src\github.com\revel\revel\revel.go:17:2: cannot find package "github.com/ag

torre/gocolorize" in any of:

D:\Go\src\github.com\agtorre\gocolorize (from $GOROOT)

D:\GO_WorkSpace\src\github.com\agtorre\gocolorize (from $GOPATH)

src\github.com\revel\revel\compress.go:13:2: cannot find package "github.com

/klauspost/compress/gzip" in any of:

D:\Go\src\github.com\klauspost\compress\gzip (from $GOROOT)

D:\GO_WorkSpace\src\github.com\klauspost\compress\gzip (from $GOPATH

)

src\github.com\revel\revel\compress.go:14:2: cannot find package "github.com

/klauspost/compress/zlib" in any of:

D:\Go\src\github.com\klauspost\compress\zlib (from $GOROOT)

D:\GO_WorkSpace\src\github.com\klauspost\compress\zlib (from $GOPATH

)

src\github.com\revel\revel\i18n.go:15:2: cannot find package "github.com/rev

el/config" in any of:

D:\Go\src\github.com\revel\config (from $GOROOT)

D:\GO_WorkSpace\src\github.com\revel\config (from $GOPATH)

src\github.com\revel\revel\router.go:18:2: cannot find package "github.com/r

evel/pathtree" in any of:

D:\Go\src\github.com\revel\pathtree (from $GOROOT)

D:\GO_WorkSpace\src\github.com\revel\pathtree (from $GOPATH)

import cycle not allowed

package github.com/revel/revel

imports golang.org/x/net/websocket

imports golang.org/x/net/websocket

src\golang.org\x\net\websocket\watcher.go:13:2: cannot find package "gopkg.i

n/fsnotify.v1" in any of:

D:\Go\src\gopkg.in\fsnotify.v1 (from $GOROOT)

D:\GO_WorkSpace\src\gopkg.in\fsnotify.v1 (from $GOPATH)

根据错误信息,分别下载以下包:

github.com/agtorre/gocolorize

github.com/klauspost/compress

github.com/revel/config

github.com/revel/pathtree

golang.org/x/net

gopkg.in/fsnotify.v1

将各个包的源码放在相应的路径下。然后再次执行:

go build github.com/revel/revel

编译成功

二、安装Revel命令行工具

下载Revel命令行工具源码,将其源码放入%GOPATH%src/github.com/revel/cmd目录下,然后在%GOPATH%src目录下进行编译操作:

编译: go build github.com/revel/cmd/revel

结果报错,如下:

D:\GO_WorkSpace\src\github.com\revel\cmd\revel\test.go:19:2: cannot find package         "github.com/revel/modules/testrunner/app/controllers" in any of:

D:\Go\src\github.com\revel\modules\testrunner\app\controllers (from $GOROOT)

D:\GO_WorkSpace\src\github.com\revel\modules\testrunner\app\controllers (from         $GOPATH)

根据错误信息,下载以下包:

github.com/revel/modules

将其源码放在相应的路径下。然后再次执行:

go build github.com/revel/cmd/revel

编译成功

三、创建 Revel 应用

重启命令行工具,然后在%GOPATH%src目录下创建 Revel 应用。

命令:

revel new MyRevelApp

revel run MyRevelApp

四、打开浏览器访问 http://localhost:9000

默认监听9000端口。

五、Revel指令

1、revel

在命令行输入`revel`,得到所有revel指令的说明:

usage: revel command [arguments]

The commands are:

new         create a skeleton Revel application

run         run a Revel application

build       build a Revel application (e.g. for deployment)

package     package a Revel application (e.g. for deployment)

clean       clean a Revel application's temp files

test        run all tests from the command-line

version     displays the Revel Framework and Go version

Use "revel help [command]" for more information.

2、revel help [command]

revel help [command]用于获取相关指令的帮助说明。例:

在命令行输入`revel help new`,得到所有关于new指令的说明:

usage: revel new [path] [skeleton]

New creates a few files to get a new Revel application running quickly.

It puts all of the files in the given import path, taking the final element in

the path to be the app name.

Skeleton is an optional argument, provided as an import path

For example:

revel new import/path/helloworld

revel new import/path/helloworld import/path/skeleton

六、Revel框架的MVC模式概念

MVC(模型-视图-控制器):

模型:描述基本的数据对象,特定的查询和更新逻辑。

视图:一些模板,用于将数据呈现给用户。

控制器:执行用户的请求,准备用户所需的数据,并指定模板进行渲染。

具体参考:

http://www.gorevel.cn/docs/manual/concepts.html

七、Revel路由配置

在Conf目录下的routes文件进行配置

具体参考:

http://www.gorevel.cn/docs/manual/routing.html

有疑问加站长微信联系(非本文作者)

php revel,Revel框架安装相关推荐

  1. CV:Win10下深度学习框架安装之Tensorflow/tensorflow_gpu+Cuda+Cudnn(最清楚/最快捷)之详细攻略(图文教程)

    CV:Win10下深度学习框架安装之Tensorflow/tensorflow_gpu+Cuda+Cudnn(最清楚/最快捷)之详细攻略(图文教程) 导读 本人在Win10下安装深度学习框架Tenso ...

  2. laravel框架安装(奶妈式手把手一步步操作)

    [实施工程师]--超级贴心的PHP[laravel框架安装]步骤实在是太详细了,必须点赞收藏. 目录 环境要求: composer服务下载: 安装Composer 测试Composer 切换Compo ...

  3. 实用必备xp框架模块_Xposed框架安装、使用以及插件开发

    Xposed框架:是一款可以在不修改APK的情况下影响程序运行(修改系统)的框架服务,基于它可以制作出许多功能强大的模块,且在功能不冲突的情况下同时运作.对原生Launcher替换图标等应用或功能均基 ...

  4. Node.js开发之Express框架安装

    Express框架安装      1.在命令行中使用全局模式安装           $ sudo npm install express@3.0.6 -g      2.建立工程           ...

  5. 十二.激光SLAM框架学习之livox-loam框架安装和跑数据集

    专栏系列文章如下: 一:Tixiao Shan最新力作LVI-SAM(Lio-SAM+Vins-Mono),基于视觉-激光-惯导里程计的SLAM框架,环境搭建和跑通过程_goldqiu的博客-CSDN ...

  6. python sanic_Sanic框架安装与简单入门示例

    本文实例讲述了Sanic框架安装与简单用法.分享给大家供大家参考,具体如下: Sanic是一个类似Flask的Python 3.5+ Web服务器,它的写入速度非常快.除了Flask之外,Sanic还 ...

  7. gin context和官方context_[系列文章] Gin框架 - 安装和路由配置

    概述 看下 Gin 框架的官方介绍: Gin 是一个用 Go (Golang) 编写的 web 框架. 它是一个类似于 martini 但拥有更好性能的 API 框架, 由于 httprouter,速 ...

  8. Python、PyCharm、Django框架安装

    一.下载Python环境 1.1 下载Python环境,以下网址: https://www.python.org/downloads/release/python-373/ 下载安装包: 1.2点击安 ...

  9. python开发软件的实例-Python 开发工具和框架安装实例步骤

    引言: 其实之前对于 Python,只是知道有这门语言而已.大部分还是使用 .net 开发的,之前也学了 MVC+EF 开发,但是由于工作上完全用不到,也就没有在博客记录学习的东西了. 最近又接触到了 ...

  10. 最新版gg服务器框架安装器,GG服务框架安装器最新版本

    GG服务框架安装器最新版本是一款非常实用的谷歌框架修复软件.这里支持的手机型号是非常多样的,常见的都是可以支持的,而且还可以为用户提供超多的修复功能,还有人工客服为用户24小时服务.如果你有心动了的话 ...

最新文章

  1. 【c语言】分解质因数
  2. 漫画:如何给女朋友解释什么是删库跑路?
  3. 企业网络推广——浅析企业网络推广怎样看待企业网站的制作
  4. boost::mp11::mp_is_map相关用法的测试程序
  5. java安全编码指南之:序列化Serialization
  6. 计算机考博哪个学校好考,管理学博士哪个学校好考
  7. codeforces Free Cash
  8. python实习生面试题_【实习】暑期实习之python笔试题(一)
  9. java sun包无法引用_关于java包的问题,自己创建一个包,里面放了源文件,却包外无法引用:具体见问题补充...
  10. mysql 字段 英文 变 中文_Oracle将英文字符集数据转换成中文
  11. ubuntu ffmpeg 录制系统音频
  12. 压力换算公斤单位换算_压力单位换算表
  13. 0804Python总结-单继承,多继承,菱形继承,__init__魔术方法(构造方法)
  14. questasim仿真优化加速问题(object无信号,无法看波形,(vsim-12110) All optimizations are disabled,error loading design)
  15. 英语谚语大全(3267条)
  16. Python通过解压ofd文件获取发票信息
  17. 手机与电脑局域网内数据互通
  18. 第29期全国人工智能师资培训启动,百度500万AI人才培养计划续航
  19. 机器学习常见损失函数,二元交叉熵,类别交叉熵,MSE,稀疏类别交叉熵
  20. 干货分享 | 如何在业余时间学习数据分析?

热门文章

  1. 为什么计算机连不上无线网络,笔记本为什么连不上无线网|笔记本电脑无法连接WiFi的多种解决方法...
  2. CM311-1-CH(JL)-YST_905L3(B)-安卓9.0-原生设置-完美AI语音精简线刷固件包
  3. CM311-1_YST_S905L3(B)_安卓9.0_设置无密码_默认打开adb_完美AI语音_线刷固件包
  4. 新冠肺炎/病毒最新治疗研究进展(2022年6月)
  5. 双硬盘分别装windows和linux,双硬盘分别安装windows和Ubuntu20双系统
  6. 双硬盘双win10互不干扰_win10系统安装双硬盘却无法显示另一个硬盘的技巧介绍...
  7. 7种大屏设计与布局思路,你不知道就亏了
  8. 【办公协作软件】万彩办公大师教程丨全能文档转换工具
  9. 2022身份识别技术大会 | 安全证件 | 可信身份认证 | 生物识别 | 公共安全安防身份技术展览会
  10. emacs go-mode 设置tab宽度