Last active
May 30, 2018 22:13
-
-
Save lotusirous/436f2f9b73b55f85496f09a2121b6e77 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
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