How can I send trace messages to the console like print when I m running my Django app under manage py runserver

0 votes
How can I send trace messages to the console (like print) when I'm running my Django app under manage.py runserver, but have those messages sent to a log file when I'm running the app under Apache?

How to handle my simple use-case?
Aug 12, 2020 in Python by kartik
• 37,530 points
1,562 views

1 answer to this question.

0 votes

Hello @kartik,

Text printed to stderr will show up in httpd's error log when running under mod_wsgi. You can either use print directly, or use logging instead.

print >>sys.stderr, 'Hii, edureka!'

Hope it helps!!
Thank you!!

answered Aug 12, 2020 by Niroj
• 82,820 points

Related Questions In Python

0 votes
1 answer
0 votes
0 answers

How can I change the loss function when the shape of my data changes?

Since my data is too large, I ...READ MORE

Mar 26, 2020 in Python by Anan
• 180 points
251 views
0 votes
1 answer

How to clear a database from the CLI with manage.py in Django?

Hello @kartik, To drop the database and run syncdb again. ...READ MORE

answered Aug 7, 2020 in Python by Niroj
• 82,820 points
834 views
0 votes
1 answer

How to temporarily disable a foreign key constraint in MySQL?

Hello @kartik, To turn off foreign key constraint ...READ MORE

answered Jun 23, 2020 in Python by Niroj
• 82,820 points
920 views
0 votes
1 answer

How do I use Django templates without the rest of Django?

Hello @kartik, Let's say you have this important ...READ MORE

answered Jun 23, 2020 in Python by Niroj
• 82,820 points
415 views
0 votes
1 answer

How can I get the domain name of my site within a Django template?

Hello kartik, The variation of the context processor ...READ MORE

answered Apr 23, 2020 in Python by Niroj
• 82,820 points
4,553 views
0 votes
1 answer