from flask import Flask, render_template import random app = Flask(__name__) @app.route('/') def welcome(): # Note that this isn't the right way to do these URLs; # we'll see the right way next time. return '''
Go to fred to see info about fred
Go to george to see info about george ''' def lucky(): return '
Your lucky number is {n}'.format(n=random.randrange(1,100)) @app.route('/fred') def fred(): return '''
This function handles the 'fred' URL'''+lucky() @app.route('/george') def george(): return '''
However, this function handles 'george'.'''+lucky() if __name__ == '__main__': import os uid = os.getuid() app.debug = True app.run('0.0.0.0',uid)