John Smith
John Smith

Reputation: 41

Pylons - Changing the regular 404 Not Found page to a custom one

How do I change the regular 404 page generated by Pylons to my own custom-made 404 page?

Thanks in advance, John

Upvotes: 1

Views: 355

Answers (2)

Natim
Natim

Reputation: 18112

Just create your view and use add_notfound_view configuration method to configure it.

See: http://docs.pylonsproject.org/docs/pyramid/en/latest/api/config.html?highlight=document%20error#pyramid.config.Configurator.add_notfound_view

Upvotes: 0

Antoine Leclair
Antoine Leclair

Reputation: 18050

From what I know, you have to edit your ErrorController in appname/controllers/error.py and change the "document" method.

def document(self):
    return render('/my_errors/blah.mako')

Read that for more details: http://wiki.pylonshq.com/display/pylonsdocs/Error+Documents#changing-the-template

Upvotes: 3

Related Questions