Skip to content

update region tags #1631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions appengine/flexible/analytics/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

#[START env]
#[START gae_flex_analytics_env_variables]
env_variables:
GA_TRACKING_ID: your-tracking-id
#[END env]
#[END gae_flex_analytics_env_variables]
4 changes: 2 additions & 2 deletions appengine/flexible/analytics/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START app]
# [START gae_flex_analytics_track_event]
import logging
import os

Expand Down Expand Up @@ -71,4 +71,4 @@ def server_error(e):
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
# [END app]
# [END gae_flex_analytics_track_event]
8 changes: 4 additions & 4 deletions appengine/flexible/cloudsql/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

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

#[START cloudsql_settings]
#[START gae_flex_mysql_settings]
# Replace project and instance with the values obtained when configuring your
# Cloud SQL instance.
beta_settings:
cloud_sql_instances: INSTANCE_CONNECTION_NAME
#[END cloudsql_settings]
#[END gae_flex_mysql_settings]
3 changes: 0 additions & 3 deletions appengine/flexible/cloudsql/create_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START all]

from main import db


if __name__ == '__main__':
print('Creating all database tables...')
db.create_all()
print('Done!')
# [END all]
4 changes: 2 additions & 2 deletions appengine/flexible/cloudsql/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def is_ipv6(addr):
return False


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

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


@app.errorhandler(500)
Expand Down
8 changes: 4 additions & 4 deletions appengine/flexible/cloudsql_postgresql/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

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

#[START cloudsql_settings]
#[START gae_flex_postgres_settings]
# Replace project and instance with the values obtained when configuring your
# Cloud SQL instance.
beta_settings:
cloud_sql_instances: INSTANCE_CONNECTION_NAME
#[END cloudsql_settings]
#[END gae_flex_postgres_settings]
3 changes: 0 additions & 3 deletions appengine/flexible/cloudsql_postgresql/create_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START all]

from main import db


if __name__ == '__main__':
print('Creating all database tables...')
db.create_all()
print('Done!')
# [END all]
4 changes: 2 additions & 2 deletions appengine/flexible/cloudsql_postgresql/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def is_ipv6(addr):
return False


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

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


@app.errorhandler(500)
Expand Down
4 changes: 2 additions & 2 deletions appengine/flexible/datastore/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def is_ipv6(addr):
return False


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

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


@app.errorhandler(500)
Expand Down
4 changes: 2 additions & 2 deletions appengine/flexible/hello_world/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START app]
# [START gae_flex_quickstart]
import logging

from flask import Flask
Expand Down Expand Up @@ -40,4 +40,4 @@ def server_error(e):
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
# [END app]
# [END gae_flex_quickstart]
12 changes: 4 additions & 8 deletions appengine/flexible/mailgun/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START app]
import logging
import os

from flask import Flask, render_template, request
import requests

# [START config]
MAILGUN_DOMAIN_NAME = os.environ['MAILGUN_DOMAIN_NAME']
MAILGUN_API_KEY = os.environ['MAILGUN_API_KEY']
# [END config]

app = Flask(__name__)


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

response = requests.post(url, auth=auth, data=data)
response.raise_for_status()
# [END simple_message]
# [END gae_flex_mailgun_simple_message]


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

response = requests.post(url, auth=auth, data=data, files=files)
response.raise_for_status()
# [END complex_message]
# [END gae_flex_mailgun_complex_message]


@app.route('/')
Expand Down Expand Up @@ -92,4 +89,3 @@ def server_error(e):
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
# [END app]
6 changes: 3 additions & 3 deletions appengine/flexible/mailjet/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

# [START env_variables]
env_variables:
# [START gae_flex_mailjet_yaml]
gae_flex_mailjet_yaml:
MAILJET_API_KEY: your-mailjet-api-key
MAILJET_API_SECRET: your-mailjet-api-secret
MAILJET_SENDER: your-mailjet-sender-address
# [END env_variables]
# [END gae_flex_mailjet_yaml]
10 changes: 4 additions & 6 deletions appengine/flexible/mailjet/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START app]
import logging
import os

from flask import Flask, render_template, request
# [START config]
# [START gae_flex_mailjet_config]
import mailjet_rest

MAILJET_API_KEY = os.environ['MAILJET_API_KEY']
MAILJET_API_SECRET = os.environ['MAILJET_API_SECRET']
MAILJET_SENDER = os.environ['MAILJET_SENDER']
# [END config]
# [END gae_flex_mailjet_config]

app = Flask(__name__)


# [START send_message]
# [START gae_flex_mailjet_send_message]
def send_message(to):
client = mailjet_rest.Client(
auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3.1')
Expand All @@ -51,7 +50,7 @@ def send_message(to):
result = client.send.create(data=data)

return result.json()
# [END send_message]
# [END gae_flex_mailjet_send_message]


@app.route('/')
Expand Down Expand Up @@ -81,4 +80,3 @@ def server_error(e):
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
# [END app]
4 changes: 2 additions & 2 deletions appengine/flexible/memcache/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

# [START env_variables]
# [START gae_flex_redislabs_memcache_yaml]
env_variables:
MEMCACHE_SERVER: your-memcache-server
# If you are using a third-party or self-hosted Memcached server with SASL
# authentiation enabled, uncomment and fill in these values with your
# username and password.
# MEMCACHE_USERNAME: your-memcache-username
# MEMCACHE_PASSWORD: your-memcache-password
# [END env_variables]
# [END gae_flex_redislabs_memcache_yaml]
6 changes: 2 additions & 4 deletions appengine/flexible/memcache/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
app = Flask(__name__)


# [START client]
# [START gae_flex_redislabs_memcache]
# Environment variables are defined in app.yaml.
MEMCACHE_SERVER = os.environ.get('MEMCACHE_SERVER', 'localhost:11211')
MEMCACHE_USERNAME = os.environ.get('MEMCACHE_USERNAME')
Expand All @@ -30,10 +30,9 @@
memcache_client = pylibmc.Client(
[MEMCACHE_SERVER], binary=True,
username=MEMCACHE_USERNAME, password=MEMCACHE_PASSWORD)
# [END client]
# [END gae_flex_redislabs_memcache]


# [START example]
@app.route('/')
def index():

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

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


@app.errorhandler(500)
Expand Down
4 changes: 2 additions & 2 deletions appengine/flexible/pubsub/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

#[START env]
# [START gae_flex_pubsub_env]
env_variables:
PUBSUB_TOPIC: your-topic
# This token is used to verify that requests originate from your
# application. It can be any sufficiently random string.
PUBSUB_VERIFICATION_TOKEN: 1234abc
#[END env]
# [END gae_flex_pubsub_env]
10 changes: 4 additions & 6 deletions appengine/flexible/pubsub/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START app]
import base64
import json
import logging
Expand All @@ -37,7 +36,7 @@
MESSAGES = []


# [START index]
# [START gae_flex_pubsub_index]
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
Expand All @@ -53,10 +52,10 @@ def index():
publisher.publish(topic_path, data=data)

return 'OK', 200
# [END index]
# [END gae_flex_pubsub_index]


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

# Returning any 2xx status indicates successful receipt of the message.
return 'OK', 200
# [END push]
# [END gae_flex_pubsub_push]


@app.errorhandler(500)
Expand All @@ -86,4 +85,3 @@ def server_error(e):
# This is used when running locally. Gunicorn is used to run the
# application on Google App Engine. See entrypoint in app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
# [END app]
6 changes: 3 additions & 3 deletions appengine/flexible/redis/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3

# [START env_variables]
env_variables:
# [START gae_flex_python_redis_yaml]
gae_flex_python_redis_yaml:
REDIS_HOST: your-redis-host
REDIS_PORT: your-redis-port
REDIS_PASSWORD: your-redis-password
# [END env_variables]
# [END gae_flex_python_redis_yaml]
Loading