Skip to content

Instantly share code, notes, and snippets.

@lotusirous
Last active May 30, 2018 22:13
Show Gist options
  • Save lotusirous/436f2f9b73b55f85496f09a2121b6e77 to your computer and use it in GitHub Desktop.
Save lotusirous/436f2f9b73b55f85496f09a2121b6e77 to your computer and use it in GitHub Desktop.
import socket
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
hostname = socket.gethostname()
ipaddr = socket.gethostbyname(hostname)
return """
<!DOCTYPE html>
<html>
<body style="text-align: center;">
<h1>Host: {h} </h1>
<h1>IP : {ip} </h1>
</body>
</html>
""".format(h=hostname, ip=ipaddr)
if __name__ == "__main__":
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment