DEV Community

Discussion on: Vue on Django, Part 4

 
io_io_rocks profile image
io • Edited

Thank you very much for the tutorial!
Do you have any idea on how I could implement Vue 2 in my already existing Django blog?
It is not very clear to me how to handle content rendering. Am I using Django templates? Do I include my Vue components in my templates?
It's all blurry :-))

Thread Thread
 
rpalo profile image
Ryan Palo

No problem. There are a couple ways to go. If you want Vue to handle the whole thing, then you can basically write the whole template in vue and just have Django serve a barebones template that just serves the vue JavaScript. If you just want vue to handle a smaller piece of the page that needs to be more responsive/interactive, then you can do the majority of the template in Django and source the js for the vue template where you need it. Don’t forget that at the end of the day, vue is just JavaScript, so you can treat it like any other vanilla JavaScript you are adding to your site. Does that help at all?

Thread Thread
 
io_io_rocks profile image
io

Hmmm, not sure I fully see it now, I need to tinker with it a bit. Thank you for replying!

Thread Thread
 
rpalo profile image
Ryan Palo

One thing that helped me was when I realized that I could simply include Vue as a script tag and have some of my templating logic live right on the same HTML file as my page layout. Here's another good resource that has a nice ramp-in. Hopefully that helps. Let me know what other questions you have, and hopefully I can help :)

Thread Thread
 
io_io_rocks profile image
io

Okey dokey, will check it out. i am onto something. Will tell you how it goes when I have something ready-ish

Thread Thread
 
rpalo profile image
Ryan Palo

Definitely do. I'm excited to see how it turns out!