Wsgi_flask_app.py doesnt work?


#1

Trying to add a Flask web script so I can start adding on a log in and log out script that would allow users to to by pass the proxy when needed. I am using the newest flask and version 2.0.1 of mitmproxy.

app = Flask(“name”) <-- under the flask examples it shows this, should I change this to something else?

@app.route(’/’)
def home():
if not session.get(‘logged_in’):
return render_template(‘login.html’)
else:
return “Hello Boss! Logout

@app.route(’/login’, methods=[‘POST’])
def do_admin_login():
if request.form[‘password’] == ‘password’ and request.form[‘username’] == ‘admin’:
session[‘logged_in’] = True
else:
flash(‘wrong password!’)
return home()

@app.route("/logout")
def logout():
session[‘logged_in’] = False
return home()

def start():
return wsgiapp.WSGIApp(app, “settings”, 4000) <–following the examples it shows something like this, but I am sure this isn’t right.


#2

Hi,

The example script works for me as-is, although some browsers seem to dislike domains without TLD. Can you verify that that’s the case for you as well?