(env) C:\Users\mramswaroop\AppData\Local\Google\Cloud SDK\getting-started-python\7-gce>python main.py
Traceback (most recent call last):
File "main.py", line 19, in <module>
app = bookshelf.create_app(config)
File "C:\Users\mramswaroop\AppData\Local\Google\Cloud SDK\getting-started-python\7-gce\bookshelf\__init__.py", line 40, in create_app
client = google.cloud.logging.Client(app.config['PROJECT_ID'])
File "C:\Users\MRAMSW~1\AppData\Local\Google\CLOUDS~1\GETTIN~1\7-gce\env\lib\site-packages\google\cloud\logging\client.py", line 104, in __init__
project=project, credentials=credentials, _http=_http)
File "C:\Users\MRAMSW~1\AppData\Local\Google\CLOUDS~1\GETTIN~1\7-gce\env\lib\site-packages\google\cloud\client.py", line 216, in __init__
Client.__init__(self, credentials=credentials, _http=_http)
File "C:\Users\MRAMSW~1\AppData\Local\Google\CLOUDS~1\GETTIN~1\7-gce\env\lib\site-packages\google\cloud\client.py", line 129, in __init__
credentials, _ = google.auth.default()
File "C:\Users\MRAMSW~1\AppData\Local\Google\CLOUDS~1\GETTIN~1\7-gce\env\lib\site-packages\google\auth\_default.py", line 317, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
(env) C:\Users\mramswaroop\AppData\Local\Google\Cloud SDK\getting-started-python\7-gce>honcho start -f ./procfile worker bookshelf
18:33:29 system | worker.1 started (pid=21680)
18:33:29 system | bookshelf.1 started (pid=26396)
18:33:30 system | bookshelf.1 stopped (rc=1)
18:33:30 system | sending SIGTERM to worker.1 (pid 21680)
18:33:30 system | worker.1 stopped (rc=4294967295)
my config.py
$ cat config.py
Copyright 2015 Google Inc.
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.
"""
This file contains all of the configuration values for the application.
Update this file with the values for your specific Google Cloud project.
You can create and manage projects at https://console.developers.google.com
"""
import os
The secret key is used by Flask to encrypt session cookies.
SECRET_KEY = 'secret'
There are three different ways to store the data in the application.
You can choose 'datastore', 'cloudsql', or 'mongodb'. Be sure to
configure the respective settings for the one you choose below.
You do not have to configure the other data backends. If unsure, choose
'datastore' as it does not require any additional configuration.
DATA_BACKEND = 'datastore'
Google Cloud Project ID. This can be found on the 'Overview' page at
https://console.developers.google.com
PROJECT_ID = 'python-bookshelf-gce-app'
CloudSQL & SQLAlchemy configuration
Replace the following values the respective values of your Cloud SQL
instance.
CLOUDSQL_USER = 'root'
CLOUDSQL_PASSWORD = 'your-cloudsql-password'
CLOUDSQL_DATABASE = 'bookshelf'
Set this value to the Cloud SQL connection name, e.g.
"project:region:cloudsql-instance".
You must also update the value in app.yaml.
CLOUDSQL_CONNECTION_NAME = 'your-cloudsql-connection-name'
The CloudSQL proxy is used locally to connect to the cloudsql instance.
To start the proxy, use:
$ cloud_sql_proxy -instances=your-connection-name=tcp:3306
Port 3306 is the standard MySQL port. If you need to use a different port,
change the 3306 to a different port number.
Alternatively, you could use a local MySQL instance for testing.
LOCAL_SQLALCHEMY_DATABASE_URI = (
'mysql+pymysql://{user}:{password}@127.0.0.1:3306/{database}').format(
user=CLOUDSQL_USER, password=CLOUDSQL_PASSWORD,
database=CLOUDSQL_DATABASE)
When running on App Engine a unix socket is used to connect to the cloudsql
instance.
LIVE_SQLALCHEMY_DATABASE_URI = (
'mysql+pymysql://{user}:{password}@localhost/{database}'
'?unix_socket=/cloudsql/{connection_name}').format(
user=CLOUDSQL_USER, password=CLOUDSQL_PASSWORD,
database=CLOUDSQL_DATABASE, connection_name=CLOUDSQL_CONNECTION_NAME)
if os.environ.get('GAE_INSTANCE'):
SQLALCHEMY_DATABASE_URI = LIVE_SQLALCHEMY_DATABASE_URI
else:
SQLALCHEMY_DATABASE_URI = LOCAL_SQLALCHEMY_DATABASE_URI
Mongo configuration
If using mongolab, the connection URI is available from the mongolab control
panel. If self-hosting on compute engine, replace the values below.
MONGO_URI = 'mongodb://user:password@host:27017/database'
Google Cloud Storage and upload settings.
Typically, you'll name your bucket the same as your project. To create a
bucket:
$ gsutil mb gs://
You also need to make sure that the default ACL is set to public-read,
otherwise users will not be able to see their upload images:
$ gsutil defacl set public-read gs://
You can adjust the max content length and allow extensions settings to allow
larger or more varied file types if desired.
CLOUD_STORAGE_BUCKET = 'sample-bookshelf-bucket'
MAX_CONTENT_LENGTH = 8 * 1024 * 1024
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
OAuth2 configuration.
This can be generated from the Google Developers Console at
https://console.developers.google.com/project/_/apiui/credential.
Note that you will need to add all URLs that your application uses as
authorized redirect URIs. For example, typically you would add the following:
If you receive a invalid redirect URI error review you settings to ensure
that the current URI is allowed.
GOOGLE_OAUTH2_CLIENT_ID =
'724249272391-f81%%%^^^$$$##mab29lmo2obof.apps.googleusercontent.com'
GOOGLE_OAUTH2_CLIENT_SECRET = 'e8%$#2323%fnPn3DvO95GHOlB'