feat: catch missing dist error
This commit is contained in:
parent
c81887024a
commit
d44301ef14
1 changed files with 13 additions and 5 deletions
8
web.py
8
web.py
|
@ -30,14 +30,22 @@ sentry_sdk.init(
|
|||
|
||||
@app.route('/')
|
||||
def home():
|
||||
try:
|
||||
return send_from_directory('dist', 'index.html')
|
||||
except:
|
||||
print(' ! dist folder missing')
|
||||
return 'dist folder missing'
|
||||
|
||||
@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'
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(e):
|
||||
|
|
Loading…
Reference in a new issue