-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathapp
More file actions
30 lines (23 loc) · 694 Bytes
/
app
File metadata and controls
30 lines (23 loc) · 694 Bytes
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
#!/usr/bin/env python
from bottle import route, view
import bottle, bottlesession
####################
#session_manager = bottlesession.PickleSession()
session_manager = bottlesession.CookieSession()
valid_user = bottlesession.authenticator(session_manager)
@route('/')
@route('/:name')
@valid_user()
def hello(name = 'world'):
return '<h1>Hello %s!</h1>' % name.title()
@route('/auth/login')
def login():
session = session_manager.get_session()
session['valid'] = True
session_manager.save(session)
bottle.redirect(bottle.request.get_cookie('validuserloginredirect', '/'))
##################
app = bottle.app()
if __name__ == '__main__':
bottle.debug(True)
bottle.run(app = app)