fix: 404.html not served on error 404
This commit is contained in:
parent
2ce604e376
commit
b8915b6dbb
1 changed files with 5 additions and 13 deletions
18
web.py
18
web.py
|
@ -28,22 +28,14 @@ sentry_sdk.init(
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
try:
|
return send_from_directory('dist', 'index.html')
|
||||||
return send_from_directory('dist', 'index.html')
|
|
||||||
except:
|
|
||||||
print(' ! dist folder missing')
|
|
||||||
return 'dist folder missing'
|
|
||||||
|
|
||||||
@app.route('/<path:path>')
|
@app.route('/<path:path>')
|
||||||
def dist(path):
|
def dist(path):
|
||||||
try:
|
if '.' in path:
|
||||||
if '.' in path:
|
return send_from_directory('dist', path)
|
||||||
return send_from_directory('dist', path)
|
else:
|
||||||
else:
|
return send_from_directory('dist', path + '/index.html')
|
||||||
return send_from_directory('dist', path + '/index.html')
|
|
||||||
except:
|
|
||||||
print(' ! dist folder missing')
|
|
||||||
return 'dist folder missing'
|
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def not_found(e):
|
def not_found(e):
|
||||||
|
|
Loading…
Reference in a new issue