Created
May 24, 2013 02:00
-
-
Save romeoh/5640821 to your computer and use it in GitHub Desktop.
GAE 폼전송.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cgi | |
from google.appengine.api import users | |
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp.util import run_wsgi_app | |
class MainPage(webapp.RequestHandler): | |
def get(self): | |
self.response.out.write(""" | |
<html> | |
<body> | |
<form action="/sign" method="post"> | |
<div><textarea name="content" rows="3" cols="60"></textarea></div> | |
<div><input type="submit" value="Sign Guestbook"></div> | |
</form> | |
</body> | |
</html> | |
""") | |
class Guestbook(webapp.RequestHandler): | |
def post(self): | |
self.response.out.write('<html><body> you wrote:<pre>') | |
self.response.out.write(cgi.escape(self.request.get('content'))) | |
self.response.out.write('</pre></body></html>') | |
application = webapp.WSGIApplication( | |
[ | |
('/', MainPage), | |
('/sign', Guestbook) | |
], | |
debug=True) | |
def main(): | |
run_wsgi_app(application) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment