-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.py
42 lines (31 loc) · 1.12 KB
/
logout.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp import util
from google.appengine.ext import webapp
from google.appengine.ext import db
from config import *
from gaesessions import get_current_session
from userinfo import UserInfo
import sys
if sys.getdefaultencoding() != 'utf8':
reload(sys)
sys.setdefaultencoding('utf8')
_DEBUG=True
class LogoutHandler(webapp.RequestHandler):
def get(self):
session = get_current_session()
session.terminate()
template_values = {
'message' : "logout successfully"
}
cwd = os.path.dirname(__file__)
path = os.path.join(cwd, 'templates', 'index.html')
self.response.out.write(template.render(path, template_values, debug=_DEBUG))
application = webapp.WSGIApplication([
('/logout', LogoutHandler)
],
debug=True)
def main():
util.run_wsgi_app(application)
if __name__ == '__main__':
main()