이상한 것들이 여기에서 발생했습니다.
handlers:
- url: /cron
script: assets/backup/main.py
- url:/
static_files: assets/index.html
upload: assets/index.html
그렇지 않으면 내가 파일을 찾을 수 없다는 미친 오류를 얻을 것 : 루트가 설정되기 전에
첫째, app.yaml
나는 나의 /cron
핸들러를 배치했다. 그 비트는 실제로 의미가 있습니다.
다음 비트는 파이썬 코드입니다. 확실하지 여기에 무슨했지만 결국 나는이 작업을 수행하여 작업 얻을 관리 있었는지 : 그것은 문제를 일으키는 무엇이든
#!/usr/bin/env python
# import logging
from google.appengine.ext import webapp
from google.appengine.api import mail
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import urlfetch
import logging
class CronMailer(webapp.RequestHandler):
def get(self):
logging.info("Backups: Started!")
urlStr = "http://example.com/file.php"
rpc = urlfetch.create_rpc()
urlfetch.make_fetch_call(rpc, urlStr)
mail.send_mail(sender="[email protected]",
to="[email protected]",
subject="Backups complete!",
body="Daily backups have been completed!")
logging.info("Backups: Finished!")
application = webapp.WSGIApplication([('/cron', CronMailer)],debug=True)
def main():
run_wsgi_app(application)
if __name__ == '__main__':
main()
은, 지금은 고정입니다.
이전 질문과 정확히 일치하지 않습니까? –
아니요, 실제로 Cron 작업을 실행하지 않았기 때문에 실제로 실행 중인지 "성공"이라고 말할 로그를 얻었습니다. 그러나 아무 것도하지 않았습니다. – James
코드가 어떻게 바뀌 었습니까? 새로운 코드를 보여주세요! 또한 브라우저에서 직접 스크립트를 실행하면 어떻게됩니까? –