qor / auth

Golang Authentication solution
MIT License
734 stars 98 forks source link

views not working #23

Open c0ze opened 5 years ago

c0ze commented 5 years ago

I just imported this and trying login / logout etc. I get

failed to find template: auth/login

I'm using go1.11.1, deps installed with modules.

I also tried installing the clean theme, but didnt help.

rogerkirkness commented 5 years ago

I had to copy the views over from the Qor project into my local app.

(root of project)/app/views/qor/*

Where * is the equivalent views folder from the auth app.

sergolius commented 4 years ago

@c0ze Looks like by default QOR expects to be used without any dependency management (GOPATH only), because of default view paths. In some cases it could be used with dependency management tool which copies/vendors repo as it's

go modules https://tip.golang.org/cmd/go/#hdr-Make_vendored_copy_of_dependencies go mod vendor - it doesn't copy asserts/vendor files like .html, .tmpl To make QOR works with go modules you have to collect used/needed views (as mentioned https://github.com/qor/auth/issues/23#issuecomment-452896864) and register on configuration stage.

See documentation, https://github.com/qor/render and it source code.

siredwin commented 2 years ago

I wish I had seen this earlier when I was dockerizing this. But it is true. It needs GOPATH. Even docker images need to be Golang images, not just any Linux images. As far as I know, Glide and Go Modules would not work for me.

sergolius commented 2 years ago

@siredwin no, alpine image is enough. As I described above assets/static files are ignored, as solution you can collect all of them and register over default assets paths. Solution 1: You have to add image binary file(build result) and collected assets to the image. Keep in mind that you have to keep structure of assets same as it's in project. Solution 2: Use bindatafs to have assets added to binary file. https://github.com/qor/admin/issues/210#issuecomment-576036535

siredwin commented 2 years ago

@sergolius, you are right. I assumed it needed GOPATH because of the exact nature of the paths. Indeed any Linux Image can work. It works. I am using solution 1 because I like to update the binary only on my programs.

ondbyte commented 2 years ago

any help regarding this, I'm coming from a frontend framework. I want to setup a small website with authentication using qor. as a initial step i am trying to add authentication to admin, but it says failed to find template: auth/login do i need to run anything before running the qor app? If Icollect all the views in a single folder like the comment above mentioned, labels in the html shows default place holders in the templates.