Skip to content

Template panic "StaticUrlPrefix" not defined #9320

Closed
@bitnom

Description

@bitnom
  • Gitea version (or commit ref): 1.10.1
  • Git version: 2.17.1
  • Operating system: Ubuntu 18.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Using the binary distribution, attempting to load templates via the custom directory causes error:

panic: template: repo/migrating:12: function "StaticUrlPrefix" not defined

goroutine 1 [running]:
html/template.Must(...)
	/usr/local/go/src/html/template/template.go:372
code.gitea.io/gitea/vendor/gitea.com/macaron/macaron.compile(0x1c80ca8, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000720680, 0x2, 0x2, ...)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/render.go:292 +0x4c8
code.gitea.io/gitea/vendor/gitea.com/macaron/macaron.(*TemplateSet).Set(0xc001a84090, 0x1c79f4d, 0x7, 0xc00073cff0, 0x0)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/render.go:318 +0x86
code.gitea.io/gitea/vendor/gitea.com/macaron/macaron.renderHandler(0x1c80ca8, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000720680, 0x2, 0x2, ...)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/render.go:385 +0x124
code.gitea.io/gitea/vendor/gitea.com/macaron/macaron.Renderer(0xc0005caf10, 0x1, 0x1, 0xc000720660, 0x203000)
	/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/render.go:422 +0x11d
code.gitea.io/gitea/modules/templates.HTMLRenderer(0x19db460, 0xc0007469a0)
	/go/src/code.gitea.io/gitea/modules/templates/static.go:118 +0x141
code.gitea.io/gitea/routers/routes.NewMacaron(0xc0000b4f20)
	/go/src/code.gitea.io/gitea/routers/routes/routes.go:169 +0x58f
code.gitea.io/gitea/cmd.runWeb(0xc0000b4f20, 0x0, 0x0)
	/go/src/code.gitea.io/gitea/cmd/web.go:110 +0x78
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x19dcfc0, 0x2e01470, 0xc0000b4f20, 0xc000091740, 0x0)
	/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:490 +0xc8
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc0000a9380, 0xc0000a21b0, 0x1, 0x1, 0x0, 0x0)
	/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:264 +0x58c
main.main()
	/go/src/code.gitea.io/gitea/main.go:109 +0x816

Since the binary distro doesn't come with any template files, I cloned the repo and copied the templates directory to /usr/local/bin/custom. Gitea runs fine until I copy these files to custom. I also tried only uploading single tmpl files that I wanted to override with similar error results.

I don't need to build gitea myself in order to use templates, do I? That would be unusual as web templates go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/questionIssue needs no code to be fixed, only a description on how to fix it yourself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions