external

Use Jinja2 template engine in external javascript file

Use Jinja2 template engine in external javascript file Question: I working on a web project using Python and Flask. I was just wondering if I can access parameters sent by python in my external javascript files? It’s working well with html files or with js embedded in html files but not when javascript is extern. …

Total answers: 2

External JavaScript file is not getting added when running on Flask

External JavaScript file is not getting added when running on Flask Question: I have an HTML file named showMap.html: <!DOCTYPE html> <html> <head> <meta name=”viewport” content=”initial-scale=1.0, user-scalable=no” /> <meta http-equiv=”content-type” content=”text/html; charset=UTF-8″ /> <title>Map</title> <script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”> </script> <script type=”text/javascript” src=”js/map.js”></script> </head> <body onload=”showPosition()”> <div id=”map_canvas” style=”width:500px;height:500px;”></div> </body> </html> And another JavaScript file map.js is …

Total answers: 4

Import python module NOT on path

Import python module NOT on path Question: I have a module foo, containing util.py and bar.py. I want to import it in IDLE or python session. How do I go about this? I could find no documentation on how to import modules not in the current directory or the default python PATH. After trying import …

Total answers: 4

Python – how do I call external python programs?

Python – how do I call external python programs? Question: I’ll preface this by saying it’s a homework assignment. I don’t want code written out for me, just to be pointed in the right direction. We’re able to work on a project of our choice so I’m working on a program to be a mini …

Total answers: 4

Python: Create Dictionary from Text/File that's in Dictionary Format

Python: Create Dictionary from Text/File that's in Dictionary Format Question: I’d like to create a dictionary from a text file that I have, who’s contents are in a ‘dictionary’ format. Here’s a sample of what the file contains: {‘fawn’: [1], ‘sermersheim’: [3], ‘sonji’: [2], ‘scheuring’: [2]} It’s exactly this except it contains 125,000 entries. I …

Total answers: 6

Loading external script with jinja2 template directive

Loading external script with jinja2 template directive Question: I’m very new to jinja2 and the use of templates in general so I was wondering if there’s an easy way to load an external javascript. I was thinking of using: {% block javascript %} <script src=”myscript.js”></script> {% endblock %} But I can’t help to ask: Is …

Total answers: 2