diff --git a/zesje/__init__.py b/zesje/__init__.py index ee839b034dd98baeb536cb42c1c29ebcd25651ec..bffcb8ad3b3e5ac4cbbbd7bf545bd68586da33a0 100644 --- a/zesje/__init__.py +++ b/zesje/__init__.py @@ -1,16 +1,21 @@ 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