0

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:

Any Coder
  • 31
  • 1
  • 4
  • Your code looks quite different from examples I've seen around https://doc.getqor.com/admin/integration.html can you try a simpler implementation and see if it fails? Also seems like the heroku tag should be added since it only happens with Heroku. – Wolfgang Dec 21 '21 at 22:43
  • @Wolfgang i tried more simpler realization, and if run it not build it doesn't cause any errors, but if i build it on my local machine or onto heroku, it causes error. I found kludge, i just copy folder "views" from qor/admin rep and put it into my project folder by path "app\views\qor". Now it works onto heroku, but, as i see in docs, it must be work without that folder. – Any Coder Dec 22 '21 at 12:50

1 Answers1

-1

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.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Any Coder
  • 31
  • 1
  • 4