Google App Engine Cron作业失败并出现以下错误

时间:2016-03-14 18:27:32

标签: python-2.7 google-app-engine cron

部署在开发系统上的相同代码工作正常,但一旦部署到生产中失败,并出现以下错误:

Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
ImportError: No module named urlhandlers

以下是URL处理程序代码:

import traceback
import datetime
from google.appengine.api import taskqueue
import re
import webapp2
from utilities.logger import logThis, AEL_LEVEL_INFO, AEL_LEVEL_CRITICAL
from constants.constants import GAET_MASTERTASK_NAME, GAEQ_FOR_MASTERTASK
import sys

class QueueAMasterTask(webapp2.RequestHandler): 
    def get(self):
        try:
            dt =datetime.datetime.now()
            logThis(AEL_LEVEL_INFO, 'Master Task added to its Q at[%s]' %(dt))            
            task_name = GAET_MASTERTASK_NAME + str(datetime.datetime.now())
            task_name = re.sub('[^a-zA-Z0-9_-]', '_', task_name)
            taskqueue.add(queue_name=GAEQ_FOR_MASTERTASK,name=task_name)
            logThis(AEL_LEVEL_INFO, "OK-MASTER TASK ADD")
        except taskqueue.DuplicateTaskNameError:
            logThis(AEL_LEVEL_CRITICAL, "EXCEPTION on QueueAMasterTask-" +     traceback.format_exc())
        except:
            logThis(AEL_LEVEL_CRITICAL, "EXP on QueueAMasterTask-" +     traceback.format_exc())

app = webapp2.WSGIApplication([('/QueueAMasterTask', QueueAMasterTask)
               ], debug=True)

Cron job error log

0 个答案:

没有答案