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('/')
|
||||
def home():
|
||||
try:
|
||||
return send_from_directory('dist', 'index.html')
|
||||
except:
|
||||
print(' ! dist folder missing')
|
||||
return 'dist folder missing'
|
||||
return send_from_directory('dist', 'index.html')
|
||||
|
||||
@app.route('/<path:path>')
|
||||
def dist(path):
|
||||
try:
|
||||
if '.' in path:
|
||||
return send_from_directory('dist', path)
|
||||
else:
|
||||
return send_from_directory('dist', path + '/index.html')
|
||||
except:
|
||||
print(' ! dist folder missing')
|
||||
return 'dist folder missing'
|
||||
if '.' in path:
|
||||
return send_from_directory('dist', path)
|
||||
else:
|
||||
return send_from_directory('dist', path + '/index.html')
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(e):
|
||||
|
|
Loading…
Reference in a new issue