DiyLightAnimation

Fun => The Porch => Topic started by: rrowan on September 30, 2013,

Title: off Topic- Python Flask Programming
Post by: rrowan on September 30, 2013,
Hi Folks,

Any Python, Flask programmers out there?
Just trying to learn how to create a Flask site and I can follow the online tutorials just fine. I have successfully follow this one: http://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework/ and
http://net.tutsplus.com/tutorials/python-tutorials/intro-to-flask-adding-a-contact-page/ and
http://net.tutsplus.com/tutorials/python-tutorials/intro-to-flask-signing-in-and-out/

Months ago I created this simple page to just play around to see how it work

{Please don't laugh}
http://rrowan327.pythonanywhere.com/Day

I would like to get that simple code in the home.html page of the above tutorial

Here is the code that I put in the routes.py file
Code: You are not allowed to view links. Register or Login
@app.route('/Day')
def Day():
    now = datetime.date.today()
    start = datetime.date(now.year, 1,1)
    delta = now - start
    return "Today is the %d day since the first of the Year." % (delta.days)

So my question is how do I call that code sniper and have it display in my home page? Yeah I could just make it javascript but that is not the exercise here. :)

After I understand that than I can go with more advance stuff which is the goal. Like have a drop listing of buildings at work and once you select a building the next field will list the floor and then rooms. After that it will show the information for that room.

Thanks

Rick R.