How do I change the regular 404 page generated by Pylons to my own custom-made 404 page?
Thanks in advance, John
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
Just create your view and use add_notfound_view
configuration method to configure it.
来源:https://stackoverflow.com/questions/2706602/pylons-changing-the-regular-404-not-found-page-to-a-custom-one