where do print statements go after being deployed?
hi, do print statements print the deploy logs? and if so is there any special variable i have to activate to ensure it prints or will it print in every case?
29 Replies
Project ID:
b5b8b5dd-ede7-45e7-93a7-4b369707abc8
b5b8b5dd-ede7-45e7-93a7-4b369707abc8
as long as you are printing unbuffered to stdout / stderr the logs will show in the deployment logs
do you happen to know why none of the print statements in teh following code are being printed in teh deploy logs?
this is my build log:
not really, but why is your code pushing itself to github?
because i want to update the code daily - i have a function called scrapeNews which I've commented out which will change the code base. i then want to push it every day
the overarching issue is that its not seeming to push to github and im trying to figure out why - hence wanting print statements. i know my script is fine because when i run it locally it pushes to github + prints everything
how about just use a database, you should not be doing what you're doing, it's extremely bad practice
why is it bad practice?
your code updating its own github repo, you are asking for trouble
yes i see, i will move to a database later but i just want to get a functioning prototype for now
and this is the last step
alright
is that function is ran by the cron scheduler and only cron?
yeah
then its only gonna be ran at that time, in the utc timezone
yeah but its not running or if it is its not pushing to github
but it works completely when i run it locally which is why im confused
is it 11:46 UTC yet?
the times you see here are not UTC
yes the time is correct
i know this because i run it locally like a minute before and it works
do you live in the UTC timezone?
no but the time is not the issue because i had deployed this code and left it up for an entire month while i was working on other projects... the function never ran
oh i know!!
you start the schedular inside this if block
if __name__ == "__main__":
but you are using gunicorn (good)
when using gunicorn __name__
will not equal "__main__"
so the scheduler will never start, start the scheduler outside of that if blocklet me try that!
still keep the timezone stuff in mind tho, that stuff is still valid
you were right once i moved the scheduler outside main it worked but i think there are major issues getting the git commands to work on the deployed machine... keeps saying directory isnt a git repo... i will look at moving teh content to a database
it's not a git repo because there's no .git folder, this is automatically omitted when you push the repo to github
is there any way aruond this?
nope, that's how github works
please for your own sake, store the data in a database
hahaha
alright
thanks for all your help
no problem!