# Import the microdot web server library from src.microdot import Microdot, Response # We also need network access so clients can connect to our web page... import network # Make sure we're connected to the network wlan = network.WLAN(network.STA_IF) if not wlan.isconnected(): print("Network isn't connected!") # If we're not connected, quit. # A better solution might be to try connecting to WiFi instead of giving up from sys import exit exit() # Print out our IP address so we know where to point the web browser! ip_address = wlan.ifconfig()[0] print("Site will be accessible at http://{}".format(ip_address)) # Set up the microdot server app = Microdot() # Main page @app.route('/') def index(request): return "This is my web server!" # Start the server running # port=80 will make it run on the default HTTP port like a normal web server # debug=True will make it print out useful information to the REPL app.run(port=80, debug=True)