2 回答
TA贡献1777条经验 获得超10个赞
包中有导出的全局变量revel,您可以使用以下任何一个:
var (
// App details
AppName string // e.g. "sample"
BasePath string // e.g. "/Users/revel/gocode/src/corp/sample"
AppPath string // e.g. "/Users/revel/gocode/src/corp/sample/app"
ViewsPath string // e.g. "/Users/revel/gocode/src/corp/sample/app/views"
ImportPath string // e.g. "corp/sample"
SourcePath string // e.g. "/Users/revel/gocode/src"
// Revel installation details
RevelPath string // e.g. "/Users/revel/gocode/src/revel"
// Where to look for templates and configuration.
// Ordered by priority. (Earlier paths take precedence over later paths.)
CodePaths []string
ConfPaths []string
TemplatePaths []string
)
如果它对您来说是空的,那很可能是因为您从基本文件夹启动了您的应用程序。
请注意,这些路径是由Init(mode, importPath, srcPath string)函数设置的。它的文档指出:
srcPath - the path to the source directory, containing Revel and the app.
If not specified (""), then a functioning Go installation is required.
- 2 回答
- 0 关注
- 144 浏览
添加回答
举报