Programming Flask applications with vue.js as a frontend framework

Update: I will be updating this post with my experience using Flask and Vue.js as a frontend framework.

Flask has become my Python framework of choice and I have been trying to use Vue.js as the front-end JS framework for an app with flask powering the backend API.

The only snag is that both Flask and Vue.js both use the double handlebar notation i.e. “{{}}” For variable interpolation in HTML, So using them both in an app could cause some headaches.

After some googling on the issue, I discovered that you could actually do this to make them play well together:

You have 2 options, modify either Flask or Vue.js

In your view file, i.e. the Python controller script, do this

from flask import Flask, render_template, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy() jinja_options.update(dict( block_start_string=’$$’, block_end_string=’$$’, variable_start_string=’$’, variable_end_string=’$’, comment_start_string=’$#’, comment_end_string=’#$’,))

Originally published at aitoehigie.wordpress.com on August 1, 2016.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.