Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe969c3

Browse filesBrowse files
authored
update region tags (GoogleCloudPlatform#1631)
* region tags: request/logging * analytics * analytics standard * quickstart * mailgun, memcache, redis * mailjet, sendgrid * static files * cloud sql and postgresql and datastore * Storage, twilio * pubsub
1 parent 5e78b33 commit fe969c3
Copy full SHA for fe969c3

File tree

Expand file treeCollapse file tree

31 files changed

+77
-112
lines changed
Filter options
Expand file treeCollapse file tree

31 files changed

+77
-112
lines changed

‎appengine/flexible/analytics/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/analytics/app.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
#[START env]
8+
#[START gae_flex_analytics_env_variables]
99
env_variables:
1010
GA_TRACKING_ID: your-tracking-id
11-
#[END env]
11+
#[END gae_flex_analytics_env_variables]

‎appengine/flexible/analytics/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/analytics/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
15+
# [START gae_flex_analytics_track_event]
1616
import logging
1717
import os
1818

@@ -71,4 +71,4 @@ def server_error(e):
7171
# This is used when running locally. Gunicorn is used to run the
7272
# application on Google App Engine. See entrypoint in app.yaml.
7373
app.run(host='127.0.0.1', port=8080, debug=True)
74-
# [END app]
74+
# [END gae_flex_analytics_track_event]

‎appengine/flexible/cloudsql/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/cloudsql/app.yaml
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
#[START env]
8+
#[START gae_flex_mysql_env]
99
env_variables:
1010
# Replace user, password, database, and instance connection name with the values obtained
1111
# when configuring your Cloud SQL instance.
1212
SQLALCHEMY_DATABASE_URI: >-
1313
mysql+pymysql://USER:PASSWORD@/DATABASE?unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME
14-
#[END env]
14+
#[END gae_flex_mysql_env]
1515

16-
#[START cloudsql_settings]
16+
#[START gae_flex_mysql_settings]
1717
# Replace project and instance with the values obtained when configuring your
1818
# Cloud SQL instance.
1919
beta_settings:
2020
cloud_sql_instances: INSTANCE_CONNECTION_NAME
21-
#[END cloudsql_settings]
21+
#[END gae_flex_mysql_settings]

‎appengine/flexible/cloudsql/create_tables.py

Copy file name to clipboardExpand all lines: appengine/flexible/cloudsql/create_tables.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# [START all]
17-
1816
from main import db
1917

2018

2119
if __name__ == '__main__':
2220
print('Creating all database tables...')
2321
db.create_all()
2422
print('Done!')
25-
# [END all]

‎appengine/flexible/cloudsql/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/cloudsql/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def is_ipv6(addr):
3434
return False
3535

3636

37-
# [START example]
37+
# [START gae_flex_mysql_app]
3838
# Environment variables are defined in app.yaml.
3939
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['SQLALCHEMY_DATABASE_URI']
4040
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
@@ -79,7 +79,7 @@ def index():
7979
output = 'Last 10 visits:\n{}'.format('\n'.join(results))
8080

8181
return output, 200, {'Content-Type': 'text/plain; charset=utf-8'}
82-
# [END example]
82+
# [END gae_flex_mysql_app]
8383

8484

8585
@app.errorhandler(500)

‎appengine/flexible/cloudsql_postgresql/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/cloudsql_postgresql/app.yaml
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
#[START env]
8+
#[START gae_flex_postgres_env]
99
env_variables:
1010
# Replace user, password, database, and instance connection name with the values obtained
1111
# when configuring your Cloud SQL instance.
1212
SQLALCHEMY_DATABASE_URI: >-
1313
postgresql+psycopg2://USER:PASSWORD@/DATABASE?host=/cloudsql/INSTANCE_CONNECTION_NAME
14-
#[END env]
14+
#[END gae_flex_postgres_env]
1515

16-
#[START cloudsql_settings]
16+
#[START gae_flex_postgres_settings]
1717
# Replace project and instance with the values obtained when configuring your
1818
# Cloud SQL instance.
1919
beta_settings:
2020
cloud_sql_instances: INSTANCE_CONNECTION_NAME
21-
#[END cloudsql_settings]
21+
#[END gae_flex_postgres_settings]

‎appengine/flexible/cloudsql_postgresql/create_tables.py

Copy file name to clipboardExpand all lines: appengine/flexible/cloudsql_postgresql/create_tables.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# [START all]
17-
1816
from main import db
1917

2018

2119
if __name__ == '__main__':
2220
print('Creating all database tables...')
2321
db.create_all()
2422
print('Done!')
25-
# [END all]

‎appengine/flexible/cloudsql_postgresql/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/cloudsql_postgresql/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def is_ipv6(addr):
4141
return False
4242

4343

44-
# [START example]
44+
# [START gae_flex_postgres_app]
4545
# Environment variables are defined in app.yaml.
4646
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['SQLALCHEMY_DATABASE_URI']
4747
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
@@ -86,7 +86,7 @@ def index():
8686
output = 'Last 10 visits:\n{}'.format('\n'.join(results))
8787

8888
return output, 200, {'Content-Type': 'text/plain; charset=utf-8'}
89-
# [END example]
89+
# [END gae_flex_postgres_app]
9090

9191

9292
@app.errorhandler(500)

‎appengine/flexible/datastore/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/datastore/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def is_ipv6(addr):
3232
return False
3333

3434

35-
# [START example]
35+
# [START gae_flex_datastore_app]
3636
@app.route('/')
3737
def index():
3838
ds = datastore.Client()
@@ -62,7 +62,7 @@ def index():
6262
output = 'Last 10 visits:\n{}'.format('\n'.join(results))
6363

6464
return output, 200, {'Content-Type': 'text/plain; charset=utf-8'}
65-
# [END example]
65+
# [END gae_flex_datastore_app]
6666

6767

6868
@app.errorhandler(500)

‎appengine/flexible/hello_world/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/hello_world/main.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
15+
# [START gae_flex_quickstart]
1616
import logging
1717

1818
from flask import Flask
@@ -40,4 +40,4 @@ def server_error(e):
4040
# This is used when running locally. Gunicorn is used to run the
4141
# application on Google App Engine. See entrypoint in app.yaml.
4242
app.run(host='127.0.0.1', port=8080, debug=True)
43-
# [END app]
43+
# [END gae_flex_quickstart]

‎appengine/flexible/mailgun/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/mailgun/main.py
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
1615
import logging
1716
import os
1817

1918
from flask import Flask, render_template, request
2019
import requests
2120

22-
# [START config]
2321
MAILGUN_DOMAIN_NAME = os.environ['MAILGUN_DOMAIN_NAME']
2422
MAILGUN_API_KEY = os.environ['MAILGUN_API_KEY']
25-
# [END config]
2623

2724
app = Flask(__name__)
2825

2926

30-
# [START simple_message]
27+
# [START gae_flex_mailgun_simple_message]
3128
def send_simple_message(to):
3229
url = 'https://api.mailgun.net/v3/{}/messages'.format(MAILGUN_DOMAIN_NAME)
3330
auth = ('api', MAILGUN_API_KEY)
@@ -40,10 +37,10 @@ def send_simple_message(to):
4037

4138
response = requests.post(url, auth=auth, data=data)
4239
response.raise_for_status()
43-
# [END simple_message]
40+
# [END gae_flex_mailgun_simple_message]
4441

4542

46-
# [START complex_message]
43+
# [START gae_flex_mailgun_complex_message]
4744
def send_complex_message(to):
4845
url = 'https://api.mailgun.net/v3/{}/messages'.format(MAILGUN_DOMAIN_NAME)
4946
auth = ('api', MAILGUN_API_KEY)
@@ -58,7 +55,7 @@ def send_complex_message(to):
5855

5956
response = requests.post(url, auth=auth, data=data, files=files)
6057
response.raise_for_status()
61-
# [END complex_message]
58+
# [END gae_flex_mailgun_complex_message]
6259

6360

6461
@app.route('/')
@@ -92,4 +89,3 @@ def server_error(e):
9289
# This is used when running locally. Gunicorn is used to run the
9390
# application on Google App Engine. See entrypoint in app.yaml.
9491
app.run(host='127.0.0.1', port=8080, debug=True)
95-
# [END app]

‎appengine/flexible/mailjet/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/mailjet/app.yaml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
# [START env_variables]
9-
env_variables:
8+
# [START gae_flex_mailjet_yaml]
9+
gae_flex_mailjet_yaml:
1010
MAILJET_API_KEY: your-mailjet-api-key
1111
MAILJET_API_SECRET: your-mailjet-api-secret
1212
MAILJET_SENDER: your-mailjet-sender-address
13-
# [END env_variables]
13+
# [END gae_flex_mailjet_yaml]

‎appengine/flexible/mailjet/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/mailjet/main.py
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
1615
import logging
1716
import os
1817

1918
from flask import Flask, render_template, request
20-
# [START config]
19+
# [START gae_flex_mailjet_config]
2120
import mailjet_rest
2221

2322
MAILJET_API_KEY = os.environ['MAILJET_API_KEY']
2423
MAILJET_API_SECRET = os.environ['MAILJET_API_SECRET']
2524
MAILJET_SENDER = os.environ['MAILJET_SENDER']
26-
# [END config]
25+
# [END gae_flex_mailjet_config]
2726

2827
app = Flask(__name__)
2928

3029

31-
# [START send_message]
30+
# [START gae_flex_mailjet_send_message]
3231
def send_message(to):
3332
client = mailjet_rest.Client(
3433
auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3.1')
@@ -51,7 +50,7 @@ def send_message(to):
5150
result = client.send.create(data=data)
5251

5352
return result.json()
54-
# [END send_message]
53+
# [END gae_flex_mailjet_send_message]
5554

5655

5756
@app.route('/')
@@ -81,4 +80,3 @@ def server_error(e):
8180
# This is used when running locally. Gunicorn is used to run the
8281
# application on Google App Engine. See entrypoint in app.yaml.
8382
app.run(host='127.0.0.1', port=8080, debug=True)
84-
# [END app]

‎appengine/flexible/memcache/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/memcache/app.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
# [START env_variables]
8+
# [START gae_flex_redislabs_memcache_yaml]
99
env_variables:
1010
MEMCACHE_SERVER: your-memcache-server
1111
# If you are using a third-party or self-hosted Memcached server with SASL
1212
# authentiation enabled, uncomment and fill in these values with your
1313
# username and password.
1414
# MEMCACHE_USERNAME: your-memcache-username
1515
# MEMCACHE_PASSWORD: your-memcache-password
16-
# [END env_variables]
16+
# [END gae_flex_redislabs_memcache_yaml]

‎appengine/flexible/memcache/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/memcache/main.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
app = Flask(__name__)
2222

2323

24-
# [START client]
24+
# [START gae_flex_redislabs_memcache]
2525
# Environment variables are defined in app.yaml.
2626
MEMCACHE_SERVER = os.environ.get('MEMCACHE_SERVER', 'localhost:11211')
2727
MEMCACHE_USERNAME = os.environ.get('MEMCACHE_USERNAME')
@@ -30,10 +30,9 @@
3030
memcache_client = pylibmc.Client(
3131
[MEMCACHE_SERVER], binary=True,
3232
username=MEMCACHE_USERNAME, password=MEMCACHE_PASSWORD)
33-
# [END client]
33+
# [END gae_flex_redislabs_memcache]
3434

3535

36-
# [START example]
3736
@app.route('/')
3837
def index():
3938

@@ -44,7 +43,6 @@ def index():
4443
value = memcache_client.incr('counter', 1)
4544

4645
return 'Value is {}'.format(value)
47-
# [END example]
4846

4947

5048
@app.errorhandler(500)

‎appengine/flexible/pubsub/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/pubsub/app.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
#[START env]
8+
# [START gae_flex_pubsub_env]
99
env_variables:
1010
PUBSUB_TOPIC: your-topic
1111
# This token is used to verify that requests originate from your
1212
# application. It can be any sufficiently random string.
1313
PUBSUB_VERIFICATION_TOKEN: 1234abc
14-
#[END env]
14+
# [END gae_flex_pubsub_env]

‎appengine/flexible/pubsub/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/pubsub/main.py
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
1615
import base64
1716
import json
1817
import logging
@@ -37,7 +36,7 @@
3736
MESSAGES = []
3837

3938

40-
# [START index]
39+
# [START gae_flex_pubsub_index]
4140
@app.route('/', methods=['GET', 'POST'])
4241
def index():
4342
if request.method == 'GET':
@@ -53,10 +52,10 @@ def index():
5352
publisher.publish(topic_path, data=data)
5453

5554
return 'OK', 200
56-
# [END index]
55+
# [END gae_flex_pubsub_index]
5756

5857

59-
# [START push]
58+
# [START gae_flex_pubsub_push]
6059
@app.route('/pubsub/push', methods=['POST'])
6160
def pubsub_push():
6261
if (request.args.get('token', '') !=
@@ -70,7 +69,7 @@ def pubsub_push():
7069

7170
# Returning any 2xx status indicates successful receipt of the message.
7271
return 'OK', 200
73-
# [END push]
72+
# [END gae_flex_pubsub_push]
7473

7574

7675
@app.errorhandler(500)
@@ -86,4 +85,3 @@ def server_error(e):
8685
# This is used when running locally. Gunicorn is used to run the
8786
# application on Google App Engine. See entrypoint in app.yaml.
8887
app.run(host='127.0.0.1', port=8080, debug=True)
89-
# [END app]

‎appengine/flexible/redis/app.yaml

Copy file name to clipboardExpand all lines: appengine/flexible/redis/app.yaml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app
55
runtime_config:
66
python_version: 3
77

8-
# [START env_variables]
9-
env_variables:
8+
# [START gae_flex_python_redis_yaml]
9+
gae_flex_python_redis_yaml:
1010
REDIS_HOST: your-redis-host
1111
REDIS_PORT: your-redis-port
1212
REDIS_PASSWORD: your-redis-password
13-
# [END env_variables]
13+
# [END gae_flex_python_redis_yaml]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.