【发布时间】:2020-03-05 19:34:22
【问题描述】:
我想在按下带有瓶子的按钮时运行一个脚本。但我每次都会收到 404 错误。它在地址栏中显示 localhost: //File.py,但我不知道如何路由它。
app.py
from bottle import *
@route('/')
def home():
return template('deneme.html')
run(host='localhost',port=8080)
文件.py
#!/usr/bin/python
import cgi, cgitb
form = cgi.FieldStorage
username = form["username"].value
emailaddress = form["emailaddress"].value
print("Content-type: text/html\r\n\r\n")
print( "<html>")
print("<head>")
print("<title>First Script</tittle>")
print("</head")
print("<body>")
print("<h3>This is HTML's Body Section</h3>")
print(username)
print(emailaddress)
print("</body>")
print("</html>")
deneme.html
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="File.py" method="post">
username: <input type="text" name="username"/>
<br />
Email Adress: <input type="email" name="emailaddress"/>
<input type="submit" name="Submit">
</form>
</body>
</html>
【问题讨论】:
-
您能否为您的声明提供更多细节或图片
It says localhost: //File.py in the address bar, but I don't know how to route it.?我认为如果他们知道it是什么,并且可以看到单击按钮时发生的情况,这将有助于其他人回答您的问题。 -
问题变了。下面的新问题