Created
November 15, 2019 14:37
-
-
Save metaperl/e8730093c12c328aa9ad70a4469f8ba3 to your computer and use it in GitHub Desktop.
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 sys | |
import uuid | |
from flask import Flask, session | |
app = Flask(__name__) | |
app.secret = str(uuid.uuid1) | |
print("Secret = {secret}.".format(secret=app.secret)) | |
@app.route('/') | |
def hello_world(): | |
if 'visits' not in session: | |
v = 0 | |
v += 1 | |
session['visits'] = v | |
return 'Hi, World! {visits}'.format(**session) | |
if __name__ == '__main__': | |
port = int(sys.argv[1]) | |
app.run(host='0.0.0.0', port=port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment