-2

ローカル ホストで Python GAE バックエンドを探索しようとすると、何も表示されず、ログを調べると、次のように表示されます。

2013-09-17 20:27:03 Running command: "['C:\\Python27\\python.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', 'C:\\Users\\Renzo\\Desktop\\engineapp']"
INFO     2013-09-17 20:27:06,841 devappserver2.py:557] Skipping SDK update check.
WARNING  2013-09-17 20:27:06,858 api_server.py:327] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO     2013-09-17 20:27:32,516 module.py:593] default: "GET / HTTP/1.1" 404 -
INFO     2013-09-17 20:27:41,940 module.py:593] default: "GET /_ah/api/explorer HTTP/1.1" 302 -
INFO     2013-09-17 20:27:45,551 module.py:593] default: "GET /_ah/api/static/proxy.html?jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.es.TB94DdVNa4o.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTONERRh8JkOutwE4dX0rKeVJfEYmg HTTP/1.1" 200 1933
ERROR    2013-09-17 23:27:45,628 wsgi.py:262] 

Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
   File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 298, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 84, in LoadObject
    obj = __import__(path[0])
  File "C:\Users\Renzo\Desktop\engineapp\backend.py", line 34
    entity.contrasenia=""
    ^
    IndentationError: unexpected indent

INFO     2013-09-17 20:27:45,638 module.py:593] default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 500 -
INFO     2013-09-17 20:27:45,638 module.py:593] default: "GET /_ah/api/discovery/v1/apis HTTP/1.1" 500 60

そして、これがコードです....

from google.appengine.ext import ndb
from google.appengine.ext import endpoints
from model_usuario import *
from protorpc import remote
from model_usuario import *

@endpoints.api(name='Usuario', version='v1', description='')
class Usuario(remote.Service):
    """Clase Usuario v1"""
    @endpoints.method(LoginRequest, LoginResponse, path='acceso', http_method='POST', name='acceso.login')

    def login(self, request):
        if(request.nombre is None):
            request.nombre=""
        Key=db.Key.from_path('Usuario', request.nombre)
        usrSearch=db.get(key)
        entity=LoginResponse()
        if(usrSearch is None):
            entity.nombre="error"
            entity.contrasenia=""
            return entity
        else:
            entity.nombre="ok"
            """entity.contrasenia="ok"""
        if(request.contrasenia==usrSerach.contrasenia):
            entity.contrasenia="ok"
        else:
            entity.contrasenia="error"
        return entity

誰かが私を助けてくれることを願っています!

4

1 に答える 1

0

例外は、エラーが何であるかを明確に述べているようです:

File "C:\Users\Renzo\Desktop\engineapp\backend.py", line 34
  entity.contrasenia=""
  ^
  IndentationError: unexpected indent

Python ではインデントが重要であり、インタープリターは指定された行のコードに何か問題があることを認識しているようです。

さて、あなたが提供したコードでは、その行は本来あるべきようにインデントされているように見えるので、次のように言う以外にあなたを助けることができるかどうかはわかりません.34行目を見て、あなたのインデントが実際のコードで修正してください!上下の行とまったく同じインデントが必要です。

于 2013-09-18T20:59:59.553 に答える