Thank you for your help.

        Here is what I figured out:

Anytime when views.py is changed it will run once, and the results will be 
shown on the server terminal window.

But each function runs only the function is called.

When a function is modified, the Class will run again.


在 2016年2月2日星期二 UTC-6下午12:43:46,James Schneider写道:
>
> On Tue, Feb 2, 2016 at 9:52 AM, Liu Duan <[email protected] <javascript:>> 
> 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/c328516e-f28d-4d01-810c-e2b7fa304640%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to