I'm trying to learn python + web2py So I want to have the index page load a different view depending on if you're logged in or not. According to my understanding of MVC this would be done on the controller. Now I've looked into the authenticate of web2py but can't really figure it out.
And is it smart to do this at the controller side or better somewhere else?
You could explicitly specify a different view in the controller:
def index():
if auth.user:
response.view = 'default/index_logged_in.html'
...
return dict(...)
If the changes from one view to the other are minimal, you can also use a single view and simply include logic to show particular content depending on the user status:
{{if auth.user:}}<div>Welcome, {{=auth.user.first_name}}</div>{{pass}}