-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bringing cloud sql sample up to standards, and fixing a few other sta…
…ndards issues in other samples
- Loading branch information
Jon Wayne Parrott
committed
Sep 24, 2015
1 parent
656607f
commit 101e24e
Showing
8 changed files
with
119 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
## Google App Engine accessing BigQuery using OAuth2 | ||
|
||
This sample demonstrates [authenticating to BigQuery in App Engine using OAuth2](https://cloud.google.com/bigquery/authorization). | ||
This sample demonstrates [authenticating to BigQuery in App Engine using OAuth2](https://cloud.google.com/bigquery/authentication). | ||
|
||
### Setup | ||
### Running the sample | ||
|
||
* To install dependencies for this sample, run: | ||
1. To install dependencies for this sample, run: | ||
|
||
$ pip install -t lib -r requirements.txt | ||
$ pip install -t lib -r requirements.txt | ||
|
||
* You must then update `main.py` and replace `<myproject_id>` with your project's | ||
id. | ||
* You'll need a client id from your project - instructions | ||
[here](https://cloud-dot-devsite.googleplex.com/bigquery/authorization#clientsecrets). | ||
Once you've downloaded the client's json secret, copy it to the root directory | ||
of this project, and rename it to `client_secrets.json`. | ||
* You can then run the sample on your development server: | ||
2. You must then update `main.py` and replace `<your-project-id>` with your project's | ||
ID. | ||
|
||
$ dev_appserver.py . | ||
3. You'll need a client id from your project - instructions | ||
[here](https://cloud.google.com/bigquery/authentication#clientsecrets). | ||
Once you've downloaded the client's json secret, copy it to the root directory | ||
of this project, and rename it to `client_secrets.json`. | ||
|
||
3. You can then run the sample on your development server: | ||
|
||
$ dev_appserver.py . | ||
|
||
Or deploy the application: | ||
|
||
$ appcfg.py update . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
# Using Cloud SQL from Google App Engine | ||
|
||
This is an example program showing how to use the native MySQL connections from Google App Engine to Google Cloud SQL. | ||
|
||
## Deploying | ||
## Running the sample | ||
|
||
1. Edit the `CLOUDSQL_INSTANCE` and `CLOUDSQL_PROJECT` values in `main.py`. | ||
|
||
2. If you have a local MySQL instance, run the app locally: | ||
|
||
dev_appserver.py . | ||
|
||
1. Edit the `unix_socket` in `main.py` to point to a Cloud SQL instance. | ||
2. Upload the app: | ||
|
||
2. Upload the app: `appcfg.py update .`. | ||
appcfg.py update . |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2015 Google Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import re | ||
|
||
import tests | ||
import webtest | ||
|
||
from . import main | ||
|
||
|
||
class TestMySQLSample(tests.AppEngineTestbedCase): | ||
|
||
def setUp(self): | ||
super(TestMySQLSample, self).setUp() | ||
self.app = webtest.TestApp(main.app) | ||
|
||
def test_get(self): | ||
response = self.app.get('/') | ||
self.assertEqual(response.status_int, 200) | ||
self.assertRegexpMatches( | ||
response.body, | ||
re.compile(r'.*version.*', re.DOTALL)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
## Google App Engine using Cloud Storage | ||
|
||
This sample demonstrates how to use cloud storage from Google App Engine | ||
This sample demonstrates how to use Google Cloud Storage from Google App Engine | ||
|
||
### Running the sample | ||
|
||
1. To install dependencies for this sample, run: | ||
|
||
$ pip install -t lib -r requirements.txt | ||
|
||
2. You must then update `main.py` and replace `<your-bucket-name>` with your Cloud Storage bucket. | ||
|
||
3. You can then run the sample on your development server: | ||
|
||
$ dev_appserver.py . | ||
|
||
Or deploy the application: | ||
|
||
$ appcfg.py update . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters