Exemple #1
0
func init() {
	//orm.RegisterDataBase("default", "mysql", "root@/gotalk?charset=utf8", 30)
	beego.AppConfigPath = "../conf/app.conf"
	beego.ParseConfig()
	setting.ReadConfig()
	orm.RunSyncdb("default", true, false)
}
Exemple #2
0
func main() {
	setting.ReadConfig()
	controllers.SocialInit()
	beego.EnableAdmin = true
	beego.SetStaticPath("/static", "static")
	beego.SetStaticPath("/avatars", "avatars")
	beego.Run()
}
Exemple #3
0
func init() {
	runtime.GOMAXPROCS(Workers)
	beego.AppConfigPath = "../conf/app.conf"
	beego.ParseConfig()
	setting.ReadConfig()
	DiscuzDb = beego.AppConfig.String("importer::discuzdb")
	AvatarPath = beego.AppConfig.String("importer::avatarpath")
	if err := orm.RegisterDataBase("discuz", "mysql", fmt.Sprintf("%s:%s@tcp(%s:3306)/%s?charset=utf8", setting.MySQLUser, setting.MySQLPassword, setting.MySQLHost, DiscuzDb)+"&loc=Asia%2FShanghai", 30); err != nil {
		fmt.Println("MySQL error:", err.Error())
		return
	}
	OrmGotalk = orm.NewOrm()
	if db, err := orm.GetDB("discuz"); err == nil {
		Orm, err = orm.NewOrmWithDB("mysql", "discuz", db)
		if err != nil {
			fmt.Println("MySQL error:", err.Error())
			return
		}
	} else {
		fmt.Println("MySQL error:", err.Error())
		return
	}
	orm.RunSyncdb("default", true, false)
}