404 and 500 Customisation - Django
Simple 3 Steps
- add a folder
templatesunder the root folder of your project; ideally it should be the same directory as yourmanage.pyfile - create
404.htmland500.htmlfiles intemplatesfolder and customize however you please - go to
settings.pychange one little thing: ```pythonassuming you haven’t changed your BASE_DIR
this is the default:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
TEMPLATES = [{ ‘DIRS’: [os.path.join(BASE_DIR, ‘templates’)], }] ``` You have to make sure that the correct html files can be properly referred to. And that’s is!!
Don Lee's Portfolio