设置
Serverless.com 框架
目标通过
无服务器创建 AWS Elastic Beanstalk
代码
serverless.yml
service: aws-beanstalk-sls
description: Test stack deployment
provider:
name: aws
stage: running
region: eu-central-1
profile: beanstalk-test-deployment
resources:
Resources:
sampleApplication:
Type: AWS::ElasticBeanstalk::Application
Properties:
Description: AWS Elastic Beanstalk Sample Application
sampleApplicationVersion:
Type: AWS::ElasticBeanstalk::ApplicationVersion
Properties:
ApplicationName:
Ref: sampleApplication
Description: AWS ElasticBeanstalk Sample Application Version
SourceBundle:
S3Bucket: elasticbeanstalk-samples-eu-central-1
S3Key: nodejs-sample.zip
sampleConfigurationTemplate:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
Properties:
SolutionStackName: 64bit Amazon Linux 2018.03 v4.7.0 running Node.js
Description: AWS ElasticBeanstalk Sample Configuration Template
ApplicationName:
Ref: sampleApplication
OptionSettings:
- Namespace: aws:autoscaling:asg …Run Code Online (Sandbox Code Playgroud) 在我的 index.html 中,我导入了一个带有模板、Shadow DOM 等自定义 Web 组件的外部 HTML 文件。
// 索引.html
...
<script src="//cdnjs.cloudflare.com/ajax/libs/polymer/0.3.4/platform.js"></script>
<link rel="import" href="/html-components/userlogin-header.html" >
<head>
<body>
<userlogin-header username="Test User"userimage="http://domain.com/img.jpg"></userlogin-header>
...
Run Code Online (Sandbox Code Playgroud)
另一个文件 userlogin-header.html:
// 用户登录-header.html
<template id="userlogin-header">
<div class="imgbox">
<img src="" class="userimage">
</div>
<div class="userinfo">
<div class="name"><span class="username"></div>
</div>
</template>
<script>
var doc = this.document.currentScript.ownerDocument,
UserLoginProto = Object.create( HTMLElement.prototype );
UserLoginProto.createdCallback = function() {
var template = doc.querySelector( "#userlogin-header" ),
box = template.content.cloneNode( true );
this.shadow = this.createShadowRoot();
this.shadow.appendChild( box );
var username = this.shadow.querySelector( '.userinfo .username' …Run Code Online (Sandbox Code Playgroud) 如何从python中获取JSON对象以通过Google App Engine数据存储区获取数据?
我在数据存储区中有以下字段的模型:
id
key_name
object
userid
created
Run Code Online (Sandbox Code Playgroud)
现在我想为一个用户获取所有对象:
query = Model.all().filter('userid', user.user_id())
Run Code Online (Sandbox Code Playgroud)
如何从查询中创建JSON对象以便我可以编写它?
我想通过AJAX调用获取数据.