Here's what I do for that - I prefer a structure where controllers and templates can be in the same folder, so I define a decorator function that I use everywhere in place of @action.uses(). That function looks for a template name with a slash in it, which indicates it's somewhere other than the location defined by settings.TEMPLATE_FOLDER. (I also use this function to pass a bunch of objects that my templates always seem to need...) Here's that function:
def default_uses(template, *extraObjs, **extraInjects):
if (index := template.rfind('/')) > 0: # accommodate a structure where templates and controllers are in the same folder
template_path = template[0:index] # templates are found in TEMPLATE_FOLDER unless a different path is specified
template = template[index+1:] # templates in other folders need to reference inclusions ie. [[include '../templates/file.html']]
t = Template(template, path=os.path.join(settings.APP_FOLDER, template_path))
else:
t = Template(template, path=settings.TEMPLATE_FOLDER)
return action.uses(t, session, auth, db, T, Inject(g=g, auth=auth, settings=settings, request=request, response=response, T=T), *extraObjs)
Then in a controller:
@action('attendee_signup', method=["GET","POST"])
@action('attendee_signup/<expo_code>', method=["GET","POST"])
@default_uses('expo/attendee_signup.html')
def attendee_signup(expo_code=None):
....
Hope that helps.