Skip to content
Advertisement

Reference error while including .js in .html in ubuntu using flask

I am trying to include a str.js and jit.js file in nev.html. Both are in same directories but it is giving me a reference error:

flask file in flask/app1.py

JavaScript

When I run it using flask, it gives this error:

JavaScript

directory structure /flask/templates

JavaScript

directory structure /flask

JavaScript

str.js file

JavaScript

nev.html

JavaScript

Advertisement

Answer

Keep css and js in a folder under ‘static’ folder in Flask app root directory. Something like following hierarchy helps:

JavaScript

and change references in templates and other files.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement