vue front-end flask back-end integration vue front-end flask back-end integration flask flask

vue front-end flask back-end integration


If you change vue-cli build to put the content of the dist folder in the Flask static folder that would work.However you'll need to change the way you initialize Flask app and serve index.html file.

# vue-flask.py   from flask import Flaskapp = Flask(__name__, static_url_path='')@app.route('/')def index():    # changed to send_static_file    return app.send_static_file('index.html')if __name__ == '__main__':    app.run(host='127.0.0.1', port=5000)

Here is the project structure:

enter image description here

I used the same approach in case of react and Flask integration but ended up splitting it down to two microservices as described here.


I've used this example in an app recently and it worked very well.

In particular the paragraph about configuring the redirects.