I try to run a simple "helloWorld" python-snippet on the new MAMP 3.5, because may old xampp got problems with the update to mac osx el capitan.
The MAMP-Documentation says that mod_wsgi, actual python and mod_python is embeded. However if i place my test.py in the htdocs and try to contact it via a JavaScript-function (ajax.POST) it seems the script is found but as result i only receive the text of my test.py in the firebug-console back. Somehow it seems the python script is not executed.
headline in test.py is #!/bin/usr/python
, i also tried to place the test.py in the MAMP/cgi-bin-directory or to use other existing python-paths (MAMP/"which python") Does anyone have an idea? Below are my two snippets:
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
var myValue = $("input:text").val();
console.log(myValue);
$.ajax({
type: "POST",
url: "test.py",
data: { myPy: myValue},
success: function(data) {
console.log("This is my result: ", data);
}
});
});
});
</script>
This is test.py:
#!/bin/usr/python
def myjsfunction (myPy):
return (myPy)