从Index.html python flask获取输入

时间:2018-12-06 01:27:52

标签: python api server

您好,我有运行烧瓶的服务器,还有2页Index.html和server.py。 我希望index.html上的用户输入从server.py获取,发送到api并发送回结果

这是

index.html

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>whatl0ol</title>



      <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">


</head>

<body>

  <div class="login">
  <div class="heading">
    <h2></h2>
    <form action=""{{ url_for('main') }}" method="post"">

      <div class="input-group input-group-lg">
        <span class="input-group-addon"><i class="fa fa-user"></i></span>
        <input type="text" class="form-control" placeholder="">
          </div>



        <button type="submit" id="send" name="send" class="float">check</button>
       </form>
        </div>
 </div>



</body>

</html>

server.py

import requests
from flask import Flask, jsonify,render_template,request

app = Flask(__name__)

@app.route("/", methods=['GET', 'POST'])




def main():

        return render_template('index.html')



if __name__  == ("__main__"):
    app.run(debug = True, host = "0.0.0.0", port =80)

谢谢

您好,我有运行烧瓶的服务器,还有2页Index.html和server.py。 我希望index.html上的用户输入从server.py获取,发送到api并发送回结果 您好,我有运行烧瓶的服务器,还有2页Index.html和server.py。 我希望index.html上的用户输入从server.py获取,发送到api并发送回结果

0 个答案:

没有答案
相关问题