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

Merge branch 'react' of ssh://gitlab.kwant-project.org:443/zesje/zesje into react

parents e926c0eb 9290c2f3
Branches
Tags
No related merge requests found
......@@ -56,6 +56,7 @@ typings/
# Yarn lock file
yarn.lock
package-lock.json
# dotenv environment variables file
.env
......
from os import path
from os.path import abspath, dirname, isfile
from werkzeug.exceptions import NotFound
from flask import Flask
from flask_basicauth import BasicAuth
......@@ -7,8 +9,7 @@ from . import db, api
static_folder_path = path.join(abspath(dirname(__file__)), 'static')
app = Flask(__name__,
static_folder= static_folder_path)
app = Flask(__name__, static_folder=static_folder_path)
db.use_db()
......@@ -23,7 +24,8 @@ app.register_blueprint(api.app, url_prefix='/api')
@app.route('/')
@app.route('/<file>')
def index(file=''):
if not isfile(path.join(static_folder_path, file)):
file = 'index.html'
return app.send_static_file(file)
\ No newline at end of file
def index(file='index.html'):
try:
return app.send_static_file(file)
except NotFound:
return app.send_static_file('index.html')
......@@ -53,8 +53,8 @@ def post_graders():
except KeyError:
abort(400)
return jsonify({
'id': new_grader.id,
'first_name': grader_spec['first_name'],
'last_name': grader_spec['last_name'],
})
return jsonify(
id=new_grader.id,
first_name=new_grader.first_name,
last_name=new_grader.last_name,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment