1
我的網頁形式如下:如何在點擊網頁表單提交時調用python s cript?
<!DOCTYPE html>
<html>
<head>
<title>Form Example</title>
<link rel="stylesheet" href="formstyle.css" type="text/css" />
</head>
<body>
<h1>Form Example</h1>
<form action="checkpoint.py" method="POST">
<input type="text" size="6" maxlength="20" name="text2" />
<input type="submit" value="Go!" />
</form>
</body>
</html>
在點擊提交時,瀏覽器會提示打開checkpoint.py文件,而不是執行它。該文件存在於相同的文件夾中。你能幫我解決我在做什麼錯嗎? 我對前端和Web開發完全陌生。
您需要將您的網絡服務器配置爲正確處理對* .py文件的請求,例如,對於Apache httpd,你可以使用cgi/fastcgi或mod_wsgi。 – AChampion 2015-03-31 07:14:57