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,520 points
2,865 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,840 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 27, 2020 in Python by Anan
• 180 points
718 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,840 points
2,772 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,840 points
2,449 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,840 points
1,564 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,840 points
9,813 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP