From f1db1b239f5c09c63165c8ed7789aaebaded51dd Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 9 Aug 2020 21:58:42 -0500 Subject: [PATCH] fix vue npm build configuration, make flask render dist folder --- client/vue.config.js | 4 ++-- server/create_app.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/vue.config.js b/client/vue.config.js index a9237fc..f734e0b 100644 --- a/client/vue.config.js +++ b/client/vue.config.js @@ -1,4 +1,4 @@ module.exports = { - indexPath: '../../dist/index.html', - assetsDir: '../../dist', + outputDir: '../dist/', + assetsDir: './static', }; diff --git a/server/create_app.py b/server/create_app.py index 4c221a5..c67a8e8 100644 --- a/server/create_app.py +++ b/server/create_app.py @@ -4,7 +4,7 @@ create_app.py The create_app function used to create and initialize the app with all of it's extensions and settings. """ -from flask import Flask +from flask import Flask, render_template from flask_cors import CORS from flask_wtf.csrf import CSRFProtect @@ -18,7 +18,10 @@ def create_app(env=None): """ The create_app function used to create and initialize the app with all of it's extensions and settings. """ - app = Flask(__name__) + app = Flask(__name__, + static_folder="./../dist/static", + template_folder="./../dist" + ) # Load configuration values if not env: @@ -39,4 +42,9 @@ def create_app(env=None): # noinspection PyUnresolvedReferences from server import api + @app.route('/', defaults={'path': ''}) + @app.route('/') + def catch_all(path): + return render_template("index.html") + return app