main.go
656 字节
package main
import (
"oppmg/common"
_ "oppmg/routers"
"oppmg/common/config"
"oppmg/common/log"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
)
func init() {
beego.BConfig.WebConfig.Session.SessionOn = true
common.ResetCommonConfig()
log.Debug("加载配置%s", config.MConfig.ConfigName)
orm.RegisterDataBase("default", "mysql", config.MConfig.SqlConn)
}
func main() {
// orm.Debug = true
// if beego.BConfig.RunMode == "dev" {
// beego.BConfig.WebConfig.DirectoryIndex = true
// beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
// }
log.Debug("应用启动")
beego.Run()
}