11

I'm coding a small application with Django. But I can't see any error logs in the console when an error (e.g. Python syntax error, etc.) occurs in one of my views -no action at all.

How can I see the error logs of my views? Debugging like a blind is really annoying.

Stephen T.
  • 1,883
  • 2
  • 15
  • 11

1 Answers1

5

Django does not print any errors to the console by default. Instead it provides very helpful error pages that are displayed for any errors that occur in your views. Please check what your DEBUG setting is set to. In development this should be True which will give you the nice error pages for 404 and 500 errors.

The pretty error page will look like this: django error page
(source: linkaider.com)

I can also recommend the talk What the Heck Went Wrong? from DjangoCon2009 for some more information on basic debugging technics with django.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Gregor Müllegger
  • 4,973
  • 1
  • 23
  • 22
  • Thanks for the reply. My DEBUG option is True but I need to get error messages from the console (where I run the "manage.py runserver" command). Is there an option for that? – Stephen T. Jan 24 '10 at 01:31
  • @Stephen T. (well, for the posterity if someone is looking this issue). You can print in the runsever using the good old "print" (print variable); also you can import pdb; pdb.set_trace() or with ipdb. – anders Jun 27 '11 at 10:15
  • What about if we cannot see error page. For example when i open a page and click form submit button. Please wait screen appears and it waits forever. So how can i see what causes this please wait screen to stuck. – ivbtar Oct 25 '18 at 09:46