Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/assemblies', methods=['GET', 'POST'])
- def assemblies():
- if request.method == 'POST':
- if request.form['submit'] == 'runFile':
- #os.startfile("/static/run.bat")
- text = "... running ..."
- filepath="/static/run.bat"
- p = subprocess.Popen(filepath, shell=True, stdout = subprocess.PIPE)
- stdout, stderr = p.communicate()
- return render_template('assemblies.html', text=text)
- else request.form['submit'] == 'process':
- [do other stuff]
- elif request.method == 'GET':
- return render_template('assemblies.html')
- <div class="container">
- <form action="/assemblies" method="post"> ASSEMBLY <br>
- <select name="Layer">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- <option value="4">4</option>
- <option value="5">5</option>
- </select><br>
- <button type="submit" name="submit" value="process"> Process </button>
- <button type="submit" name="submit" value="runFile"> Run </button>
- </form>
- </div>
- start /d "static" myFile.exe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement