-
-
Save dcasati/1811b39b3f6a3fed017335fec2e876b1 to your computer and use it in GitHub Desktop.
Example Python WSGI app which displays the hostname of the system it runs on when accessing /hostname
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route("/hostname/") | |
def return_hostname(): | |
return "This is an example wsgi app served from {} to {}".format(socket.gethostname(), request.remote_addr) | |
if __name__ == "__main__": | |
app.run(host='0.0.0.0') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment