I want to connect my localhost from flask to a public address.
This is my simple flask app (also a simple index.html with 2 buttons):
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def index():
if request.method == 'POST':
if request.form.get('action1') == 'VALUE1':
print('Value1')
elif request.form.get('action2') == 'VALUE2':
print('Value2')
return render_template("index.html")
if __name__ == '__main__':
app.run()
I managed to established a connection with MAMP and localhost.run, but when I try to change the port from flask it gives me an error on the final result (not a crash, just "this page isn't working).
I need this because I want to run some codes from my pc using a webpage.