Max00355
Max00355

Reputation: 867

Rendering multiple templates with web.py

Ive recently gotten into Webdesign in Python, I've tried multiple frameworks but web.py seems to be my favorite except for one problem. I cant seem to figure out how to make multiple pages with multiple templates....

here is my code so far:

import web

urls = (

'/', 'index', '/login/', 'login'


)

app = web.application(urls, globals())
render = web.template.render('templates/')

class index():
    def GET(self):
        return render.index()
class login():
    def GET(self):
        return render.login()



if __name__ == '__main__':
    app.run()

I get an error when I try to go to the login page :/

Upvotes: 0

Views: 1050

Answers (1)

Andrey Kuzmin
Andrey Kuzmin

Reputation: 4479

Try changing your url mapping:

urls = (
    '/', 'index', 
    '/login/?', 'login',
)

/login/? will work for /login and /login/ url paths.

It will be better if you show an exception that you get.

Upvotes: 1

Related Questions