Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🤗 [Question]: Is it possible to use django/v3 on gofiber/v3.0.0-beta? #333

Open
3 tasks done
var-rain opened this issue Feb 1, 2024 · 9 comments
Open
3 tasks done
Labels
🤔 Question Further information is requested

Comments

@var-rain
Copy link

var-rain commented Feb 1, 2024

Question Description

I've tried using django/v3 on gofiber/v3 but can't get past '{{ xxx }}' to get the arguments. is there a problem with my code?

Code Snippet (optional)

package main

import (
	// "github.com/gofiber/fiber/v2" // he worked very well.
	"github.com/gofiber/fiber/v3"
	"github.com/gofiber/template/django/v3"
)

func main() {
	engine := django.New("views", ".html")
	engine.SetAutoEscape(false)
	app := fiber.New(fiber.Config{
		Views: engine,
	})
        // app.Get("/", func(ctx *fiber.Ctx) error { // gofiber/v2
	app.Get("/", func(ctx fiber.Ctx) error {
		return ctx.Render("index", fiber.Map{
			"Title":   "test title",
			"Content": "test content",
		})
	})
	app.Listen(":7200")
}

// views/index.html
// 
// <!DOCTYPE html>
// <html lang="en">
// <head>
//    <title>{{ Title }}</title>
// </head>
// 
// <body>
// <div>
//     {{ Content }}
// </div>
// </body>
// </html>

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my questions prior to opening this one.
  • I understand that improperly formatted questions may be closed without explanation.
@var-rain var-rain added the 🤔 Question Further information is requested label Feb 1, 2024
@var-rain
Copy link
Author

var-rain commented Feb 1, 2024

I've used the gofiber/v3 for production

@sixcolors
Copy link
Member

@var-rain confirm this works with v2 but not main/v3?

@var-rain
Copy link
Author

var-rain commented Feb 1, 2024

@var-rain confirm this works with v2 but not main/v3?

Yes, the same code I tried several times between v2 and v3, when using {{ Content }} to get data in v2 it works fine, but in v3 you get a blank page

@var-rain
Copy link
Author

var-rain commented Feb 1, 2024

@var-rain confirm this works with v2 but not main/v3?

look this ↓↓↓↓↓
simple_test_v3
simple_test_v2

@gaby
Copy link
Member

gaby commented Feb 2, 2024

@var-rain The middlewares haven't been migrated/Tested with Fiber V3

@var-rain
Copy link
Author

var-rain commented Feb 2, 2024

@var-rain The middlewares haven't been migrated/Tested with Fiber V3

Ok, thanks, I thought django/v3 was the counterpart to gofiber/v3.

@var-rain var-rain closed this as completed Feb 2, 2024
@gaby
Copy link
Member

gaby commented Feb 2, 2024

@var-rain That's the version for the django template. It's in the todo list to migrate these to GoFiber v3

@var-rain
Copy link
Author

var-rain commented Feb 2, 2024

@var-rain That's the version for the django template. It's in the todo list to migrate these to GoFiber v3

I've tried html (html/template) before this and it works on v3, so...

@gaby
Copy link
Member

gaby commented Feb 2, 2024

Lets re-open this then

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🤔 Question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants