On Tue, Feb 2, 2016 at 9:52 AM, Liu Duan <[email protected]> wrote: > If I insert a line in views.py like: > > Print “Hello world.” > > Is there a way I can see the result? > > > In other words, how do I monitor views.py running? > > > The preferred method is to use logging: https://docs.djangoproject.com/en/1.9/topics/logging/
However, if you are running the dev server, print statements within any of your code will show on the console output where the dev server is running. I'd recommend spending a little time getting to know the logging system. It is much more flexible and allows you to increase/decrease verbosity when needed for troubleshooting, etc. It's also just as easy to use as a print statement after the initial setup (writing logging.debug() is pretty much as easy as print()). I also find that having those extra log lines works as pseudo documentation (hints are probably a better term) for what is/should be happening at that moment in the source. -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXEw678MaiD4MEiTS_WS%3D0ocD3ddO84aOBpDfjRVCfjrw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

