feat: return 404 when static file not found for requested route
This commit is contained in:
parent
e1c3358d61
commit
8512e7cf81
1 changed files with 7 additions and 4 deletions
11
web.py
11
web.py
|
@ -32,10 +32,13 @@ def home():
|
|||
|
||||
@app.route('/<path:path>')
|
||||
def dist(path):
|
||||
if '.' in path:
|
||||
return send_from_directory('dist', path)
|
||||
else:
|
||||
return send_from_directory('dist', path + '/index.html')
|
||||
try:
|
||||
if '.' in path:
|
||||
return send_from_directory('dist', path)
|
||||
else:
|
||||
return send_from_directory('dist', path + '/index.html')
|
||||
except:
|
||||
return send_from_directory('dist', '404.html'), 404
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(e):
|
||||
|
|
Loading…
Reference in a new issue