skip to Main Content

Code in script tag of HTML within a flask app throwing small annoying errors

Home.html file: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Home</title> <link rel="stylesheet" type="text/css" href="{{url_for("static",filename="css/css.css")}}"> </head> <body> <h1>Welcome to recipe book</h1> <p>{{length}}</p> <script> const amount = "{{length}}"; let list = {{images | tojson}}; const base_URL = "{{ url_for('static',filename='images') }}"; const altText =…

VIEW QUESTION

Html – simple javascript code linked with flask not working

Home.html file: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Home</title> <link rel="stylesheet" type="text/css" href="{{url_for("static",filename="css/css.css")}}"> </head> <body> <h1>Welcome to recipe book</h1> <p>{{length}}</p> <script> const amount = {{length}}; console.log(amount); </script> </body> </html> main.py Flask python file: #,redirect,url_for,send_from_directory, from flask import Flask,render_template import os…

VIEW QUESTION
Back To Top
Search