So - what this is telling us is that exception is not a positional parameter - it’s a keyword parameter.
You could try:
def custom_page_not_found(request, exception=None, template_name="errors/404.html"):
or leave it at:
def custom_page_not_found(request, **kwargs):
and get the keyword args from kwargs as needed. (e.g. kwargs.get('template_name', 'errors/404.html')
or anything else along those lines.