Leo505 Leo505 - 24 days ago 8
Python Question

Django print in prod' server

I've gotten use to using print in my python code to show contents of variable and checking the shell output.
But i have now migrated all my work onto a online server. Pythonanywhere

I don't have the foggiest idea how to do the same now?
Can someone point me in the right direction?
Print to web console? To a file? Or even to the shell session?

Thanks

Answer

On production server your print statements will output log to your webserver log files In case of pythonanywhere there are three log files

Access log:yourusername.pythonanywhere.com.access.log
Error log:yourusername.pythonanywhere.com.error.log
Server log:yourusername.pythonanywhere.com.server.log

those logs are accessible in your web tab page.

The logs you are looking for will be in server.log

Comments