Я могу перейти на свою главную страницу, индекс. html страницу, используя flask, но когда я нажимаю кнопку на странице индекса, страница перенаправляется на страницу mytopo. html, но не отображается топология и появляется ошибка , Я получаю сообщение об ошибке ниже, когда пытаюсь go на mytopo. html страница. Кажется, он не может найти мой json файл (mytopo. json)
192.168.56.1 - - [16/Jan/2020 11:31:15] "GET /mytopo HTTP/1.1" 200 -
192.168.56.1 - - [16/Jan/2020 11:31:15] "GET /mytopo.json HTTP/1.1" 404 -
Это структура flask проекта
mywebfolder
myapp.py --- main file and run server
static --- for images
image1.jpg
templates --- all html files are here
index.html
mytopo.html
data --- my json file is store here
mytopo.json
myapp.py
app = Flask(__name__)
#Function for index page
@app.route('/')
def startPage():
bodyText=Markup("<b>MAIN PAGE</b>")
return render_template('index.html', bodyText=bodyText)
#topology view
@app.route('/mytopo')
def mytopo():
return render_template("mytopo.html")
index. html
<button style="width:10px;height:10px"><font size="6"><a href="mytopo">Topology View</a></font></button>
mytopo. html предназначен для просмотра топологии с использованием файлов vis. js и json (mytopo. json)
var json = $.getJSON("mytopo.json")
.done(function(data){
var data = {
nodes: data.nodes,
edges: data.edges
};
var network = new vis.Network(container, data, options);
});
var container = document.getElementById('mynetwork');
</script>
Я действительно ценю, что кто-то может привести меня ... Пожалуйста, помогите и спасибо.