Friday, November 15, 2013

Changes 11/15/13

Post-note (Bottle app):

  • Simple bottle app to look at how POST works for bottle and web forms in general
  • Text box allows for text entry, and when submit is clicked, the text from the text box is put in a variable, which is then set to a <h2> element
  • Code was largely copied from Math Drill and adapted
  • Learned about the app.post() method and how it interfaces with the webpage
  • Learned about the python global keyword and how it is used
  • Interestingly, the global  message variable seems to clear itself after awhile; I assume this is due to Google's hosting servers wanting to save resources
  • App was uploaded to Google App Engine (after learning the process with Math Drill it was really easy, too)
  • App is live at www.post-note.appspot.com
  • Styling and other stuff is eventually going to be added
  • The code will probably be cleaned up, since this is serves as a good example for how POST works in bottle

1 comment:

  1. This is not only a good example, but a useful tool for the classroom. See yesterday's post for my next feature request. Regarding the global variable disappearing after awhile, it is not a good idea to store state in memory. You would need either a file or some other non-volatile storage (a database, at some point) to store state that is meant to last.

    ReplyDelete