Google App engine 404 on App spot(在本地部署)

2024-06-01 05:29:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用python2.7使用googleappengine启动器创建我的第一个应用程序,但我无法部署我的应用程序。以下是我采取的步骤:

  1. 在谷歌开发者控制台上创建了这个应用。在
  2. 在应用程序yaml具有应用程序的名称,并且配置正确。在
  3. 在本地测试应用程序并启动。在
  4. 单击“部署”后重定向到google,然后我登录以访问应用程序并重定向到: http://localhost:8080/?code=4/y8crEPdA5yunLMKIebPmjtojnhXKY4BWXhyzJDnkay8#
  5. http://helloep-1100.appspot.com/我得到一个404错误。在

地狱世界_api.py文件

 import endpoints
    from protorpc import messages
    from protorpc import message_types
    from protorpc import remote

    REQUEST_CONTAINER = endpoints.ResourceContainer(
        message_types.VoidMessage,
        name=messages.StringField(1),
    )


    package = 'Hello'


    class Hello(messages.Message):
        """String that stores a message."""
        greeting = messages.StringField(1)


    @endpoints.api(name='helloworldendpoints', version='v1')
    class HelloWorldApi(remote.Service):
        """Helloworld API v1."""

        @endpoints.method(message_types.VoidMessage, Hello,
          path = "sayHello", http_method='GET', name = "sayHello")
        def say_hello(self, request):
          return Hello(greeting="Hello World")

        @endpoints.method(REQUEST_CONTAINER, Hello,
          path = "sayHelloByName", http_method='GET', name = "sayHelloByName")
        def say_hello_by_name(self, request):
          greet = "Hello {}".format(request.name)
          return Hello(greeting=greet)


    APPLICATION = endpoints.api_server([HelloWorldApi])

应用程序yaml

^{pr2}$

Tags: namefromimportapi应用程序httpmessagehello