Advertisement
silver2row

Date and Time on a Server (Richardson)...

Aug 9th, 2019
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. from flask import Flask, render_template
  2. app = Flask(__name__)
  3. import datetime
  4.  
  5. # from "Getting Started with BeagleBone, (Richardson 2013)."
  6.  
  7. @app.route("/")
  8. def hello():
  9.     now = datetime.datetime.now()
  10.     timeString = now.strftime("%d-%m-%Y %H:%M")
  11.     templateData = {
  12.         "title": "This is your date and time!",
  13.         "time": timeString
  14.     }
  15.     return render_template("more.html", **templateData)
  16.  
  17. if __name__=="__main__":
  18.     app.run(host="0.0.0.0", port=5000, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement