Skip to content
Snippets Groups Projects
Commit 6468ac7c authored by Thomas Roos's avatar Thomas Roos
Browse files

Fix client side router fallback

parent 1597f233
Branches
Tags
No related merge requests found
from os import path
from os.path import abspath, dirname
from os.path import abspath, dirname, isfile
from flask import Flask
from . import db, api
static_folder_path = path.join(abspath(dirname(__file__)), 'static')
app = Flask(__name__,
static_folder=path.join(abspath(dirname(__file__)), 'static'))
static_folder= static_folder_path)
db.use_db()
app.register_blueprint(api.app, url_prefix='/api')
@app.route('/')
@app.route('/<file>')
def index(file=None):
return app.send_static_file(file or 'index.html')
def index(file=''):
if (isfile(path.join(static_folder_path, file))):
return app.send_static_file(file)
else:
return app.send_static_file('index.html')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment