cherrybombuc
Posts: 24
Joined: Mon Feb 25, 2013 4:59 pm

R-pi python html

Fri Apr 12, 2013 8:17 pm

hi
I have those codes

python

from flask import Flask, render_template
import datetime
app = Flask(__name__)

@app.route("/")
def hello():
now = datetime.datetime.now()
timeString = now.strftime("%Y-%m-%d %H:%M")
templateData = {
'title' : 'HELLO!',
'time': timeString
}
return render_template('main.html', **templateData)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80, debug=True)


and html

<!DOCTYPE html>
<head>
<title>{{ title }}</title>
</head>

<body>
<h1>Hello, World!</h1>
<h2>The date and time on the server is: {{ time }}</h2>
</body>
</html>

how do I run it, I want to view on my computer with ip
thanks

Return to “Networking and servers”