Я пытаюсь загрузить данные на мою flask страницу и записать их в консоль, однако я получаю сообщение об ошибке ниже
VM165:1 Uncaught ReferenceError: data is not defined
at <anonymous>:1:13
Это фрагменты кода из моих .py и. html
import os
from flask import Flask, render_template, jsonify, request, redirect
import json
app = Flask(__name__)
@app.route("/")
def home():
json_file = open("/Users/-------/Documents/GitHub/Geospatial-Opportunities-for-Supermarkets/supermarket_locations/longos_locations.json", "r", encoding ="utf-8")
data = json.load(json_file)
json_file.close
return render_template("index.html", data = data)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Supermarkets in Toronto</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.0-rc.3/dist/leaflet.css" />
<link rel="stylesheet" type="text/css" href="static/css/style.css">
<script> var data = '{{data}}'; </script>
</head>