title: GET and POST with node boostrap 4 form and python 3 flask
body: <p>I have a form in an html file like so, and I need to pass this over to a python file, which will do a bunch of stuff and return the output back to the html page. The confusing thing is I use <code>npm start</code> for starting up the website and would usually use some other flask server for doing flask stuff. How would I make this work? Do I even need a flask server?</p>
  
  <p>The returned data from python should either go back to the same HTML element or to another element.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form action="path/my_script.py" method="post" role="form"&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="python_input"&gt;python input or link&lt;/label&gt;
          &lt;input type="text" class="form-control" id="python_input" aria-describedby="pythonHelp" placeholder="Enter python_input required&gt;
              &lt;div class="valid-feedback"&gt;Looks good!
              &lt;/div&gt;
                   &lt;small id="pythonHelp" class="form-text text-muted"&gt;Pick your diamond from James Allen's
                         &lt;a href="https://www.example.com/"&gt;website&lt;/a&gt; and copy paste the info or URL here&lt;/small&gt;
       &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Python 3:</p>
  
  <pre><code>import json
  import pandas as pd
  from flask import Flask, render_template, request, redirect
  import os
  
  app = Flask(__name__)
  
  
  @app.route('/myForm.html', methods=['POST', 'GET'])
  def regression():
      python_input= request.form['python_input']
      #do more stuff here
      return 'you posted the '+str(python_input)
  
  
  if __name__ == '__main__':
      app.run(port=12345, debug=True)```
  </code></pre>