· 8 years ago · May 09, 2017, 11:30 AM
1# Copyright 2015 Google Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""
16This file contains all of the configuration values for the application.
17Update this file with the values for your specific Google Cloud project.
18You can create and manage projects at https://console.developers.google.com
19"""
20
21import os
22
23# The secret key is used by Flask to encrypt session cookies.
24# [START secret_key]
25SECRET_KEY = 'hourfriend'
26# [END secret_key]
27
28# There are three different ways to store the data in the application.
29# You can choose 'datastore', 'cloudsql', or 'mongodb'. Be sure to
30# configure the respective settings for the one you choose below.
31# You do not have to configure the other data backends. If unsure, choose
32# 'datastore' as it does not require any additional configuration.
33DATA_BACKEND = 'cloudsql'
34
35# Google Cloud Project ID. This can be found on the 'Overview' page at
36# https://console.developers.google.com
37PROJECT_ID = 'healthy-life-165611'
38
39# CloudSQL & SQLAlchemy configuration
40# Replace the following values the respective values of your Cloud SQL
41# instance.
42CLOUDSQL_USER = 'root'
43CLOUDSQL_PASSWORD = ''
44CLOUDSQL_DATABASE = 'mysql'
45# Set this value to the Cloud SQL connection name, e.g.
46# "project:region:cloudsql-instance".
47# You must also update the value in app.yaml.
48CLOUDSQL_CONNECTION_NAME = 'healthy-life-165611:us-east1:hourfriend'
49
50# The CloudSQL proxy is used locally to connect to the cloudsql instance.
51# To start the proxy, use:
52#
53# $ cloud_sql_proxy -instances=your-connection-name=tcp:3306
54#
55# Port 3306 is the standard MySQL port. If you need to use a different port,
56# change the 3306 to a different port number.
57
58# Alternatively, you could use a local MySQL instance for testing.
59LOCAL_SQLALCHEMY_DATABASE_URI = (
60 'mysql+pymysql://{user}:{password}@127.0.0.1:3306/{database}').format(
61 user=CLOUDSQL_USER, password=CLOUDSQL_PASSWORD,
62 database=CLOUDSQL_DATABASE)
63
64# When running on App Engine a unix socket is used to connect to the cloudsql
65# instance.
66LIVE_SQLALCHEMY_DATABASE_URI = (
67 'mysql+pymysql://{user}:{password}@localhost/{database}'
68 '?unix_socket=/cloudsql/{connection_name}').format(
69 user=CLOUDSQL_USER, password=CLOUDSQL_PASSWORD,
70 database=CLOUDSQL_DATABASE, connection_name=CLOUDSQL_CONNECTION_NAME)
71
72if os.environ.get('GAE_INSTANCE'):
73 SQLALCHEMY_DATABASE_URI = LIVE_SQLALCHEMY_DATABASE_URI
74else:
75 SQLALCHEMY_DATABASE_URI = LOCAL_SQLALCHEMY_DATABASE_URI
76
77# Mongo configuration
78# If using mongolab, the connection URI is available from the mongolab control
79# panel. If self-hosting on compute engine, replace the values below.
80MONGO_URI = 'mongodb://user:password@host:27017/database'
81
82# Google Cloud Storage and upload settings.
83# Typically, you'll name your bucket the same as your project. To create a
84# bucket:
85#
86# $ gsutil mb gs://<your-bucket-name>
87#
88# You also need to make sure that the default ACL is set to public-read,
89# otherwise users will not be able to see their upload images:
90#
91# $ gsutil defacl set public-read gs://<your-bucket-name>
92#
93# You can adjust the max content length and allow extensions settings to allow
94# larger or more varied file types if desired.
95CLOUD_STORAGE_BUCKET = 'healthy-life-165611.appspot.com'
96MAX_CONTENT_LENGTH = 8 * 1024 * 1024
97ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
98
99# OAuth2 configuration.
100# This can be generated from the Google Developers Console at
101# https://console.developers.google.com/project/_/apiui/credential.
102# Note that you will need to add all URLs that your application uses as
103# authorized redirect URIs. For example, typically you would add the following:
104#
105# * http://localhost:8080/oauth2callback
106# * https://<your-app-id>.appspot.com/oauth2callback.
107#
108# If you receive a invalid redirect URI error review you settings to ensure
109# that the current URI is allowed.
110GOOGLE_OAUTH2_CLIENT_ID = \
111 'your-client-id'
112GOOGLE_OAUTH2_CLIENT_SECRET = 'your-client-secret'