0

I am doing as suggested in https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete

I have used Flask + HTML5 + JS

Flask project directory structure is:

Flask /
      Flask.py
      static /
              js / Flask.js
              styles / Flask.css
      templates / Flask.html

I have included the Flask.js in Flask.html as below, in all possible places (in top, bottom, out of <head>, etc) of html file:

<script type="text/javascript" src="static/js/Flask.js"></script> 

When I put all the code in html file as mentioned in the link above, everything works well, but when I separate out the js part to Flask.js in the structure above, it doesn't work.

Kindly let me know what am I doing wrong or if you need any additional information.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Rookie
  • 735
  • 5
  • 11
  • 30

1 Answers1

1

The recommended approach is to use url_for helper function:

src="{{ url_for('static', filename='js/Flask.js') }}"

to link your static files.

doru
  • 9,022
  • 2
  • 33
  • 43