Problem with Gin Gonic and Qor Admin: error 500 on heroku

171 Views Asked by At

I want to create an admin panel for my project and i used Qor admin with Gin. When i tested it on localhost it didnt cause any errors or exeptions, but when i commit it to heroku i`ll get 500 error; I use Gorm v1 as an ORM. How can i fix the error?

This is main project file is:

package main

import (
    "net/http"
    "os"

    "github.com/gin-gonic/gin"
    "github.com/qor/admin"
)

func main() {
    connect()

    Admin := admin.New(&admin.AdminConfig{DB: db})

    adminServer := http.NewServeMux()
    Admin.MountTo("/admin", adminServer)
    Admin.AddResource(&User{})

    app := gin.Default()
    //app.LoadHTMLGlob("views/*")
    app.MaxMultipartMemory = 140 << 20
    gin.SetMode(gin.ReleaseMode)

    Controller(app)

    port := os.Getenv("PORT")
    if port == "" {
        port = "5000"
    }

    app.Any("/admin/*resources", gin.WrapH(adminServer))
    app.Run(":" + port)
}

And what i get as a result when i try to open AP: And what i get as a result when i try to open AP:

1

There are 1 best solutions below

0
Any Coder On

I found the method: You can just put the folder from the qor/admin repository into your project folder by path <project_folder>/app/views/qor. In the folder named qor, there must be .tmpl files and static-content folders.