Reputation: 1
I want to make a very simplistic graphical interface that will allow the user to enter a few bits of information into a form and then I will crunch the data and spit out a google map to the web page the user is interfacing with.
However, this will just run on a local machine instead of being a webpage that is served to the user. I would like to do the "data crunching" in python so I would like the javascript to be able to pass the form data to a python function and then do some stuff and then output back to the webpage.
Is there a good way to do this? Any suggestions? I just want to have a web form as the frontend because this seems the easiest, but I am open to suggestions.
Upvotes: 0
Views: 1554
Reputation: 16
If you want to use python on a local machine you will depend on the client having it, and not only that, you would have to check their current version and work twice to make it work for both 2.X and 3.X.
I would do as mozillanerd said, and work only with javascript.
If you love python I can't see a way better to do this that using python on your server, using something like python-shell (for node.js):
var PythonShell = require('python-shell');
var options = {
args: [latitude, longitude]
};
PythonShell.run('my_script.py', options, function (err, results) {
if (err) throw err;
console.log('results: %j', results);
});
Upvotes: 0
Reputation: 560
Please note http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=v8&lang2=python . Python is slower than javascript; most javascript engines are very quick.
Upvotes: 2