-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathmain.go
35 lines (32 loc) · 977 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
_ "pybbs-go/routers"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"pybbs-go/models"
_ "github.com/go-sql-driver/mysql"
_ "pybbs-go/utils"
_ "pybbs-go/templates"
)
func init() {
url := beego.AppConfig.String("jdbc.url")
port := beego.AppConfig.String("jdbc.port")
username := beego.AppConfig.String("jdbc.username")
password := beego.AppConfig.String("jdbc.password")
orm.RegisterDataBase("default", "mysql", username+":"+password+"@tcp("+url+":"+port+")/pybbs-go?charset=utf8&parseTime=true&charset=utf8&loc=Asia%2FShanghai", 30)
orm.RegisterModel(
new(models.User),
new(models.Topic),
new(models.Section),
new(models.Reply),
new(models.ReplyUpLog),
new(models.Role),
new(models.Permission))
orm.RunSyncdb("default", false, true)
}
func main() {
//orm.Debug = true
//ok, err := regexp.MatchString("/topic/edit/[0-9]+", "/topic/edit/123")
//beego.Debug(ok, err)
beego.Run()
}