Q:

Why can't I console log data from my flask application? I am using jinja

I am trying load data into my flask page, and console log it, however I keep getting the below error
VM165:1 Uncaught ReferenceError: data is not defined
    at <anonymous>:1:13

These are the code snippets from my .py and .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>

A:

Looks like I had 2 index.html files and I was using the wrong one

