I need to configure cron to work using Google AppEngine, which will use urllib2 to execute a webpage hosted on my other server.
I know that a script is running (logs checked), but my log inside my python script is never output.
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
import logging
import urllib
import urllib2
class MainHandler(webapp.RequestHandler):
def get(self):
logging.info('Starting backups.')
def main():
application = webapp.WSGIApplication([('/', MainHandler)],
debug=True)
util.run_wsgi_app(application)
urlStr = "http://example.com/cron.php"
request = urllib2.Request(urlStr)
try:
response = urllib2.urlopen(request)
logging.info("Backup complete!")
except URLError, e:
logging.error('There was an error %s', e.reason)
if __name__ == '__main__':
main()
Can anyone see something wrong with this?
source
share