Google应用引擎:应用部署但没有API

时间:2015-08-28 07:23:11

标签: python google-app-engine deployment

我正在Google App Engine上部署应用程序。在管理日志中,我看到它已成功部署,"已完成新默认版本的更新"。但我从来没有看到" API配置更新服务"之后的消息。

当我访问API资源管理器时,服务中没有任何内容。

注意:当我将相同的@ endpoints.method添加到另一个应用程序时,在部署此应用程序时会显示API。所以,我认为这是愚蠢的事情。我的代码和部署输出如下。我很感激任何指针!

部署输出

**使用以下标志运行appcfg.py:     --oauth2_credential_file =〜/ .appcfg_oauth2_tokens更新 12:06 AM应用:apns-push;版本:1 上午12:06主持人:appengine.google.com 上午12:06 开始更新app:apns-push,版本:1 上午12:06获取当前资源限制。 12:06 AM扫描本地磁盘上的文件。 上午12:06克隆1个静态文件。 12:06 AM克隆3个应用程序文件。 上午12:06编译开始。 上午12:06编译完成。 上午12:06开始部署。 12:06 AM检查部署是否成功。 上午12:06部署成功。 12:06 AM检查更新的应用程序版本是否正在服务。 12:06 AM完成app的更新:apns-push,版本:1 上午12:06上传索引定义。 如果部署失败,您可能需要回滚'手动。 "制作符号链接......"菜单选项可以帮助完成命令行工作。 ** appcfg.py已完成退出代码0 **

代码

@endpoints.api( name='apns_server',
            version='v1',
            allowed_client_ids=[WEB_CLIENT_ID,API_EXPLORER_CLIENT_ID],
            scopes=[EMAIL_SCOPE])
class APNSPush(remote.Service):
"""Conference API v0.1"""

# - - - Profile objects - - - - - - - - - - - - - - - - - - -    @endpoints.method(RegisterForm, BooleanMessage,
        path='registerDevice', http_method='POST', name='registerDevice')
def registerDevice(self, request):
    """Update & return user profile."""
    ret_val=True
    prof = Profile()

    buf =  'received device Token'   
    logging.debug(buf)

    for field in ('userID', 'deviceUUID','deviceToken'):
            if hasattr(request, field):
                val = getattr(request, field)
                if val:
                    setattr(prof, field, str(val))
                    buf =  '%s %s' % (field,val)   
                    logging.debug(buf)
                else:
                    buf =  'Could not get value for field %s' % (field)   
                    logging.debug(buf)
                    ret_val=False
            else:
                buf =  '%s not present' % (field)   
                logging.debug(buf)
                ret_val=False  
    prof.put()

    return BooleanMessage(data=ret_val)

api = endpoints.api_server([APNSPush])  

1 个答案:

答案 0 :(得分:1)

发现了这个问题。我正在使用基于GoogleAppEngineLauncher UI的应用进行部署。在添加New AppEngine项目时(使用左键单击 - > New选项),除了包含应用程序文件的文件夹之外,我还指定了应用程序ID。在这种情况下,启动程序希望文件位于name = ApplicationID。

的文件夹下

解决方案未指定Application-ID。启动器将使用app.yaml中的应用程序ID,现在一切都很顺利。

相关问题