-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Bringing cloud sql sample up to standards, and fixing a few other sta… #118
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering why it can't just go in requirements-dev.txt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only for GAE. May move it into requirements-dev.txt at a later date.