本文整理汇总了Golang中github.com/astaxie/beego.SetStaticPath函数的典型用法代码示例。如果您正苦于以下问题:Golang SetStaticPath函数的具体用法?Golang SetStaticPath怎么用?Golang SetStaticPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetStaticPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
beego.SetStaticPath("/js", "static/js")
beego.SetStaticPath("/img", "static/img")
beego.SetStaticPath("/css", "static/css")
beego.Router("/", &controllers.MainController{})
beego.Router("/unit/list", &controllers.UnitController{}, "get:List")
beego.Router("/unit/create", &controllers.UnitController{}, "get:CreateHtml")
beego.Router("/unit/create", &controllers.UnitController{}, "post:Create")
beego.Router("/unit/:id:int/update", &controllers.UnitController{}, "get:UpdateHtml")
beego.Router("/unit/:id:int/update", &controllers.UnitController{}, "post:Update")
beego.Router("/unit/:id:int/run", &controllers.UnitController{}, "get:Run")
beego.Router("/unit/:id:int/delete", &controllers.UnitController{}, "get:Delete")
beego.Router("/dockerd/list", &controllers.DockerdController{}, "get:List")
beego.Router("/dockerd/create", &controllers.DockerdController{}, "get:CreateHtml")
beego.Router("/dockerd/create", &controllers.DockerdController{}, "post:Create")
beego.Router("/dockerd/:id:int/update", &controllers.DockerdController{}, "get:Update")
beego.Router("/dockerd/:id:int/delete", &controllers.DockerdController{}, "get:Delete")
beego.Router("/ippool/list", &controllers.IPPoolController{}, "get:ListAll")
beego.Router("/ippool/list/used", &controllers.IPPoolController{}, "get:ListUsed")
beego.Router("/ippool/list/free", &controllers.IPPoolController{}, "get:ListFree")
beego.Router("/ippool/create", &controllers.IPPoolController{}, "get:CreateHtml")
beego.Router("/ippool/create", &controllers.IPPoolController{}, "post:Create")
beego.Router("/ippool/:id:int/release", &controllers.IPPoolController{}, "get:Release")
beego.Router("/ippool/:id:int/delete", &controllers.IPPoolController{}, "get:Delete")
}
示例2: main
func main() {
tracelog.StartFile(tracelog.LevelTrace, "logs", 1)
tracelog.Started("main", "Initializing Postgres")
var confName string = os.Getenv("BOOKS_CONF")
if len(confName) == 0 {
confName = "default"
}
s := []string{"conf/db/", confName, ".json"}
jsonconf, err := config.NewConfig("json", strings.Join(s, ""))
if err != nil {
tracelog.Errorf(err, "main", "config.NewConfig", "Failed to find config", strings.Join(s, ""))
}
var User string = jsonconf.String("User")
var Pass string = jsonconf.String("Pass")
var DBName string = jsonconf.String("DBName")
var buffer bytes.Buffer
buffer.WriteString("user=")
buffer.WriteString(User)
buffer.WriteString(" password=")
buffer.WriteString(Pass)
buffer.WriteString(" dbname=")
buffer.WriteString(DBName)
s2 := []string{"user=", User, " password=", Pass, " dbname=", DBName, " sslmode=disable"}
orm.RegisterDriver("postgres", orm.DR_Postgres)
orm.RegisterDataBase("default", "postgres", strings.Join(s2, ""))
beego.SetStaticPath("/images", "static/images")
beego.SetStaticPath("/css", "static/css")
beego.SetStaticPath("/js", "static/js")
beego.SetStaticPath("/fonts", "static/fonts")
beego.SetStaticPath("/partials", "static/partials")
beego.EnableAdmin = true
orm.RunCommand()
beego.Run()
}
示例3: main
func main() {
beego.SessionOn = true
beego.SetStaticPath("/img", "static/img")
beego.SetStaticPath("/css", "static/css")
beego.SetStaticPath("/js", "static/js")
beego.Run()
}
示例4: initStatic
func initStatic() error {
uploadPath := utils.GetConf().String("upload::root")
err := utils.EnsurePath(uploadPath)
if err != nil {
return err
}
jobPath := uploadPath + utils.GetConf().String("upload::job")
err = utils.EnsurePath(jobPath)
if err != nil {
return err
}
exportPath := uploadPath + utils.GetConf().String("upload::export")
err = utils.EnsurePath(exportPath)
if err != nil {
return err
}
beego.DirectoryIndex = true
beego.StaticDir["/public"] = "public/"
beego.SetStaticPath("/img", "public/img")
beego.SetStaticPath("/export", exportPath)
beego.SetStaticPath("/"+controllers.StaticPathPhoto, uploadPath)
return nil
}
示例5: main
func main() {
initialize()
beego.Info(beego.AppName, APP_VER)
beego.InsertFilter("/docs/images/:all", beego.BeforeRouter, routers.DocsStatic)
if !routers.IsPro {
beego.SetStaticPath("/static_source", "static_source")
beego.DirectoryIndex = true
}
beego.SetStaticPath("/products/images", "products/images/")
// Register routers.
beego.Router("/", &routers.HomeRouter{})
beego.Router("/community", &routers.CommunityRouter{})
beego.Router("/quickstart", &routers.QuickStartRouter{})
beego.Router("/video", &routers.VideoRouter{})
beego.Router("/products", &routers.ProductsRouter{})
beego.Router("/team", &routers.PageRouter{})
beego.Router("/about", &routers.AboutRouter{})
beego.Router("/donate", &routers.DonateRouter{})
beego.Router("/docs/", &routers.DocsRouter{})
beego.Router("/docs/:all", &routers.DocsRouter{})
beego.Router("/blog", &routers.BlogRouter{})
beego.Router("/blog/:all", &routers.BlogRouter{})
// Register template functions.
beego.AddFuncMap("i18n", i18n.Tr)
beego.Run()
}
示例6: Get
func (c *MainController) Get() {
beego.SetStaticPath("/static", "static")
beego.SetStaticPath("/images", "images")
beego.SetStaticPath("/css", "css")
beego.SetStaticPath("/js", "js")
c.TplName = "login.tpl"
}
示例7: main
func main() {
setting.ReadConfig()
controllers.SocialInit()
beego.EnableAdmin = true
beego.SetStaticPath("/static", "static")
beego.SetStaticPath("/avatars", "avatars")
beego.Run()
}
示例8: init
func init() {
beego.SetStaticPath("/js", "static/js")
beego.SetStaticPath("/css", "static/css")
beego.SetStaticPath("/fonts", "static/fonts")
beego.SetStaticPath("/img", "static/img")
beego.Router("/", &controllers.MainController{})
beego.Router("/ws", &controllers.WSController{})
}
示例9: main
func main() {
beego.SessionOn = true
beego.SetStaticPath("/img", "static/img")
beego.SetStaticPath("/css", "static/css")
beego.SetStaticPath("/js", "static/js")
beego.SetStaticPath("/easyui", "static/easyui")
beego.SetStaticPath("/bootstrap", "static/bootstrap")
beego.Run()
}
示例10: main
func main() {
beego.SetStaticPath("/images", "static/images")
beego.SetStaticPath("/css", "static/css")
beego.SetStaticPath("/js", "static/js")
beego.Router("/:shorturl:string", &controllers.RedirectController{})
beego.Router("/", &controllers.ShortenController{})
beego.Run()
}
示例11: init
func init() {
beego.SetStaticPath("/views", "views")
beego.SetStaticPath("/static", "static")
beego.Router("/", &controllers.MainController{})
beego.Router("/api/proxy", &controllers.ProxyController{})
// go regexp doesn't support Negative lookahead
beego.Router("/:word(.*)", &controllers.RedirectController{})
}
示例12: main
func main() {
// 注册文件目录
beego.SetStaticPath("UPLOADS", "UPLOADS")
beego.SetStaticPath("EDU", "EDU")
// 启动session
beego.SessionOn = true
// 注册模板函数
RegisterFuncMap()
beego.Run()
}
示例13: init
func init() {
orm.RegisterDriver("mysql", orm.DR_MySQL)
dbLink := "root:" + "[email protected](192.168.2.114:3306)/sfs?charset=utf8"
orm.RegisterDataBase("default", "mysql", dbLink)
//orm.Debug = true
o := orm.NewOrm()
o.Using("default")
beego.SetStaticPath("/img", "img")
beego.SetStaticPath("/css", "css")
beego.SetStaticPath("/js", "js")
}
示例14: main
func main() {
beego.SetStaticPath("css", "static/css")
beego.SetStaticPath("js", "static/js")
//初始化
initialize()
beego.SessionOn = true
beego.AutoRender = false
beego.AddFuncMap("i18n", i18n.Tr)
beego.Run()
}
示例15: init
func init() {
orm.RegisterDriver("mysql", orm.DR_MySQL)
//dbLink := "ocs:" + "[email protected](dbdev.gz.cvte.cn:3306)/sfs?charset=utf8"
//dbLink := "root:" + "[email protected](192.168.2.114:3306)/sfs?charset=utf8"
dbLink := beego.AppConfig.String("dbuser") + ":" + beego.AppConfig.String("dbpass") + "@tcp(" + beego.AppConfig.String("dbhost") + ":" + beego.AppConfig.String("dbport") + ")/" + beego.AppConfig.String("dbname") + "?charset=utf8"
orm.RegisterDataBase("default", "mysql", dbLink)
//orm.Debug = true
o := orm.NewOrm()
o.Using("default")
beego.SetStaticPath("/img", "img")
beego.SetStaticPath("/css", "css")
beego.SetStaticPath("/js", "js")
}