Beispiel #1
0
func main() {
	setting.Initialize()
	beego.SetLogFuncCall(true)
	beego.SetViewsPath("views")

	if setting.IsProMode {
		beego.Info(setting.PostgresMigrateConnection)
		//auto migrate db
		//todo: we may want to disable this later
		//dbMigrate()
	} else {
		beego.Info("Develment mode enabled")
	}
	dbMigrate()
	beego.Info(beego.BConfig.AppName, setting.APP_VER, setting.AppUrl)
	testOnly() //todo:remove this
	//dev directory listing
	if !setting.IsProMode {
		beego.SetStaticPath("/assets", "static/dist/assets")
		beego.BConfig.WebConfig.DirectoryIndex = true
	}
	orm.RegisterDriver("postgres", orm.DRPostgres)

	orm.RegisterDataBase("default", "postgres", setting.PostgresConnection)
	services.Register()
	orm.RunCommand()
	orm.Debug = true

	controllers.RegisterControllers()

	if beego.BConfig.RunMode == "dev" {
		//	beego.Router("/test/:tmpl(mail/.*)", new(base.TestRouter))
	}
	beego.Run()
}
Beispiel #2
0
func init() {
	theme := GetTheme()

	beego.SetStaticPath("/static", theme+"/static")
	beego.SetViewsPath(theme + "/views")

}