Created
May 24, 2013 01:50
-
-
Save romeoh/5640790 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
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): | |
user = users.get_current_user() | |
if user: | |
self.response.headers['Content-Type'] = 'text/plain' | |
self.response.out.write('hello, ' + user.nickname()) | |
else: | |
self.redirect(users.create_login_url(self.request.uri)) | |
application = webapp.WSGIApplication( | |
[('/.*', MainPage)], | |
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