12

I have created a template for the 500 HTTP error.

I have inserted my template 500.html in:

  1. /project/
  2. /project/templates/
  3. /python2.5/
  4. /python2.5/templates/

but I always get this error:

TemplateDoesNotExist: 500.html

I get the same problem for an HTTP 404 error.

Why?

Paul Sasik
  • 76,452
  • 19
  • 147
  • 184
xRobot
  • 24,150
  • 62
  • 173
  • 291

2 Answers2

10

You might need to specify the template directories in settings.py, if you haven't already.

e.g. in my settings.py, I have:

ROOTDIR = os.path.abspath(os.path.dirname(__file__)) 
TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    ROOTDIR + '/logistics/templates',
)
kafuchau
  • 5,523
  • 6
  • 32
  • 38
  • 1
    First, try adding this to your template_dirs: C:\Python25\Lib\site-packages\django\contrib\admin\templates\admin and see if that loads the default Django templates at all... And, if it does, then you're not specifying your dirs correctly. Note: my python instance and installed at C:\, change the path to whatever is right for your system. – kafuchau May 12 '10 at 20:58
4

Try to set
DEBUG=True in your settings file

Maria Sakharova
  • 1,339
  • 14
  • 15
  • 23
    Definitely not on a production machine. – nisc Nov 04 '11 at 17:38
  • But on a devel machine it's quite useful. I couldn't remember why I didn't get debug messages anymore, so this hint is rather helpful. Thanks! :) – Oszkar Feb 03 '12 at 19:32
  • Normally this error occurs once setting up the installation the first time, by which you probably don't have lots of traffic. The standard error logging only helps you so much. – Jonatan Littke Apr 02 '12 at 12:34
  • Debug True at least said something more to fix the bug, thanks a lot! – Coconut Oct 30 '13 at 14:02