Looking for interactive data transfer

27 views
Skip to first unread message

ashish

unread,
Nov 1, 2011, 12:38:06 PM11/1/11
to Google App Engine
Hey all

Im a newbie to appengine.
Ive been trying to do something like this.I have a html page with
forms.Based on the user data submitted through forms I have to get
some data stored in datastore and display it within the same
page(append).
And Im working in python.

So can anybody help me wit this?How to go about here?

Thanks
Ashish

David Whittaker

unread,
Nov 1, 2011, 9:50:06 PM11/1/11
to Google App Engine
Welcome to web programming 101! We were all newbies once. There are
several components to an application like this, but to get you
started, what you are describing is very similar to the Guestbook demo
application included in the SDK. Look in your demos/guestbook folder
in your python appengine SDK folder, and you will see the simplest
possible example of posting a form, storing the data, and displaying
it back on the page. Open the guestbook.py file to get an idea of how
it all works.

Here's the basic idea:
when you load the main page (the root http://appname.appspot.com/) the
application is directed to the MainPage class (see the application =
lines near the bottom of the file). This class, in its get method,
query's the BigTable for the last 10 greetings, loops through them,
and writes them to the response. Then, at the bottom, it writes the
form to the response. You could always switch this up and write the
form first and then the Greetings, or split them up to separate pages,
or anything along those lines. Notice that the form's action points
to the /sign url, which the application (at the bottom) routes to the
Guestbook class. It's post method creates a new Greeting record, sets
its author and content data (the date is automatically set when it is
saved), and saves the Greeting to the BigTable. Finally, it redirects
you back to the root / to display the Greeting you just added (and up
to 9 others) and the form again.

This tutorial describes the application in more detail:
http://code.google.com/appengine/docs/python/gettingstarted/

Take a look at the tutorial and source code, and let us know if you
have any more questions.

David
Reply all
Reply to author
Forward
0 new messages