Getting Authentication module for web.py 0.3 to work

40 views
Skip to first unread message

Monty808

unread,
Feb 8, 2012, 8:30:09 PM2/8/12
to web.py
Hi,

I am trying to get Authentication module for web.py 0.3 from
http://jpscaletti.com/webpy_auth/ to work.

I places the download files on my machine into /usr/local/lib/
python2.7/dist-packages/web.py-0.36-py2.7.egg/web/contrib



Below is my code and the error message when I browse to http://0.0.0.0:8080/.
But it redirects to http://0.0.0.0:8080/login where I get the error.
So...just wondering is there is a know issues or if I did something
wrong.

Thanks

#!/usr/bin/python
import web
from web.contrib.auth import DBAuth

render = web.template.render('templates/')
web.config.debug = False
web.internalerror = web.debugerror
urls=('/','index')
db = web.database(dbn='mysql', db='rtb', user='root', pw='test')
app = web.application(urls, globals())
settings = {}
auth = DBAuth(app, db, **settings)

def notfound():
return 'not found'
class index:
@auth.protected()
def GET(self):
web.header("Content-Type","text/html; charset=utf-8")
return "test"

if __name__ == "__main__":
web.webapi.internalerror = web.debugerror
app.notfound = notfound
app.run()


raise AttributeError, "No template named " + name
AttributeError: No template named login

127.0.0.1:43433 - - [09/Feb/2012 09:26:37] "HTTP/1.1 GET /login" - 500
Internal Server Error
Reply all
Reply to author
Forward
0 new messages