def delete_index():
if not safe_str_cmp(request.form.get('secret', ''),
current_app.config['SEARCH_INDEX_SECRET']):
abort(403)
index_path = get_index_path()
if index_path is not None:
try:
shutil.rmtree(index_path)
except (OSError, IOError):
pass
deleted = not os.path.isdir(index_path)
if deleted:
return Response(status=204)
else:
return Response(status=500)
评论列表
文章目录