<p>cant get the orm to run. </p>
<p>Iam getting the following error. "must have one register DataBase alias named <code>default</code>" not sure why its not working? been googling about and havent found anything of use. below is my code in my main.go</p>
<pre><code>func init() {
orm.RegisterDriver("sqlite3", orm.DRSqlite)
err := orm.RegisterDataBase("default", "sqlite3", "file:sqlite/podcast.db")
if err != nil {
panic(err)
}
orm.RegisterModel(new(models.Admin))
orm.RunSyncdb("default", false, true)
}
func main() {
o := orm.NewOrm()
o.Using("default")
beego.Run()
}
</code></pre>
<p>can someone tell me if iam doing something wrong with the above code. i think running the db before running beego seems wrong to me but iam not sure. i changed this around and get the same issue. any help is appreciated.</p>
<hr/>**评论:**<br/><br/>eoin_ahern: <pre><p>guess im not using the orm then. lol</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传