Search code examples
web2py

Web2py: how to style / replace "invalid function" page?


How do I provide an alternative or bespoke "invalid function" page when visiting e.g. mysite.org/no/page? The default one is a bit basic for me.


Solution

  • You can specify routes_onerror in the routes.py file to deliver a custom page:

    routes_onerror = [('myapp/404', '/myapp/static/custom_404.html')]
    

    The custom page can also be a dynamic route, such as /myapp/mycontroller/custom_error.