feat: catch missing dist error
This commit is contained in:
parent
c81887024a
commit
d44301ef14
1 changed files with 13 additions and 5 deletions
18
web.py
18
web.py
|
@ -30,14 +30,22 @@ sentry_sdk.init(
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
return send_from_directory('dist', 'index.html')
|
try:
|
||||||
|
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):
|
||||||
if '.' in path:
|
try:
|
||||||
return send_from_directory('dist', path)
|
if '.' in path:
|
||||||
else:
|
return send_from_directory('dist', path)
|
||||||
return send_from_directory('dist', path + '/index.html')
|
else:
|
||||||
|
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