Я пытаюсь заставить jQuery JavaScript работать во Flask. При загрузке html-сайта в моем браузере html-код отображается должным образом. Напротив, при загрузке через приложение Flask кажется, что JavaScript не выполняется.
Я подозреваю, что это может иметь какое-то отношение к пути к скриптам. Однако у меня закончились перестановки, чтобы попробовать.
Сторона Python:
from flask import Flask, render_template, flash, request
# App config.
DEBUG = True
app = Flask(__name__)
app.config.from_object(__name__)
app.config['SECRET_KEY'] = '314589pyuwdfdfegkjbn3689'
@app.route("/", methods=['GET', 'POST'])
def index():
return render_template('index2.html')
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5000)
Сторона HTML:
<!DOCTYPE html>
<html lang = "en">
<head>
<!-- Bootstrap -->
<link href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel = "stylesheet">
<link href = "css/jquery.treetable.css" rel = "stylesheet">
<link href = "css/jquery.treetable.theme.default.css" rel = "stylesheet">
</head>
<div class = "container">
<br>
<form method = "post">
<div class = "container" style = "width:980px;margin:auto;"
<table class = "table table-striped">
<table>
<thead>
<th>Exception</th>
</thead>
<tbody>
<tr data-tt-id = "1">
<td>File1</td>
</tr>
<tr data-tt-id = "1.1" data-tt-parent-id = "1">
<td>Column1</td>
</tr>
<tr data-tt-id = "1.1.1" data-tt-parent-id = "1.1">
<td>Exception1</td>
</tr>
</table>
<input type = "submit" value = "Submit">
</div>
</form>
<br>
</div>
<br>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src = "jquery.treetable.js"></script>
<script>
$('table').treetable({ expandable: true });
</script>
</body>
</html>
Ошибок в консоле нет. Вывод, связанный с jquery.treetable.js: "127.0.0.1 - - [28 / сен / 2018 13:43:16]" GET /jquery.treetable.js HTTP / 1.1 "404 -"
Ага, значит, не находит.
Смотрите мой ответ здесь: stackoverflow.com/a/48722831/5734311



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


<script src = "jquery.treetable.js"></script>выглядит подозрительно (он не указывает на каталогstatic). У вас ошибки в консоли?