底下程式匯入Model.py
裡面宣告自定物件WooTuUser
在第13行實作該物件卻發現沒有反應
在debug模式下,執行到該行會閃兩次
接著直接跳到_init_.py的return func(*params)
經測試後發現是Python無法正確匯入WooTuUser物件的關係
後來把第4行的”import Model”
改成”from Model import WooTuUser”後
就可以正確執行了
1: import wsgiref.handlers2: from google.appengine.ext import webapp3: from pyamf.remoting.gateway.google import WebAppGateway4: import Model5:6: class MainPage(webapp.RequestHandler):7: def get(self):8: self.response.headers['Content-Type'] = 'text/plain'9: self.response.out.write('Hello, World!')10:11:12: def echo(data):13: u = WooTuUser(id=data.id, password=data.password)14: u.put()15: return data16:17: services = { 'myservice.echo': echo, }18:19: def main():20: application_paths = [('/', WebAppGateway(services)), ('/helloworld', MainPage)]21: application = webapp.WSGIApplication(application_paths, debug=True,)22: wsgiref.handlers.CGIHandler().run(application)