|
| 1 | +# Copyright 2015 Google Inc. All rights reserved. |
| 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 | +""" |
| 16 | +Django settings for mysite project. |
| 17 | +
|
| 18 | +Generated by 'django-admin startproject' using Django 1.8.5. |
| 19 | +
|
| 20 | +For more information on this file, see |
| 21 | +https://docs.djangoproject.com/en/1.8/topics/settings/ |
| 22 | +
|
| 23 | +For the full list of settings and their values, see |
| 24 | +https://docs.djangoproject.com/en/1.8/ref/settings/ |
| 25 | +""" |
| 26 | + |
| 27 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
| 28 | +import os |
| 29 | + |
| 30 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 31 | + |
| 32 | + |
| 33 | +# Quick-start development settings - unsuitable for production |
| 34 | +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ |
| 35 | + |
| 36 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 37 | +SECRET_KEY = '-c&qt=71oi^e5s8(ene*$b89^#%*0xeve$x_trs91veok9#0h0' |
| 38 | + |
| 39 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 40 | +DEBUG = True |
| 41 | + |
| 42 | +# SECURITY WARNING: App Engine's security features ensure that it is safe to |
| 43 | +# have ALLOWED_HOSTS = ['*'] when the app is deployed. If you deploy a Django |
| 44 | +# app not on App Engine, make sure to set an appropriate host here. |
| 45 | +# See https://docs.djangoproject.com/en/1.10/ref/settings/ |
| 46 | +ALLOWED_HOSTS = ['*'] |
| 47 | + |
| 48 | +# Application definition |
| 49 | + |
| 50 | +INSTALLED_APPS = ( |
| 51 | + 'django.contrib.admin', |
| 52 | + 'django.contrib.auth', |
| 53 | + 'django.contrib.contenttypes', |
| 54 | + 'django.contrib.sessions', |
| 55 | + 'django.contrib.messages', |
| 56 | + 'django.contrib.staticfiles', |
| 57 | + 'polls', |
| 58 | +) |
| 59 | + |
| 60 | +MIDDLEWARE_CLASSES = ( |
| 61 | + 'django.contrib.sessions.middleware.SessionMiddleware', |
| 62 | + 'django.middleware.common.CommonMiddleware', |
| 63 | + 'django.middleware.csrf.CsrfViewMiddleware', |
| 64 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 65 | + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', |
| 66 | + 'django.contrib.messages.middleware.MessageMiddleware', |
| 67 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 68 | + 'django.middleware.security.SecurityMiddleware', |
| 69 | +) |
| 70 | + |
| 71 | +ROOT_URLCONF = 'mysite.urls' |
| 72 | + |
| 73 | +TEMPLATES = [ |
| 74 | + { |
| 75 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 76 | + 'DIRS': [], |
| 77 | + 'APP_DIRS': True, |
| 78 | + 'OPTIONS': { |
| 79 | + 'context_processors': [ |
| 80 | + 'django.template.context_processors.debug', |
| 81 | + 'django.template.context_processors.request', |
| 82 | + 'django.contrib.auth.context_processors.auth', |
| 83 | + 'django.contrib.messages.context_processors.messages', |
| 84 | + ], |
| 85 | + }, |
| 86 | + }, |
| 87 | +] |
| 88 | + |
| 89 | +WSGI_APPLICATION = 'mysite.wsgi.application' |
| 90 | + |
| 91 | + |
| 92 | +# Database |
| 93 | +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases |
| 94 | + |
| 95 | +# [START db_setup] |
| 96 | +if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine'): |
| 97 | + # Running on production App Engine, so connect to Google Cloud SQL using |
| 98 | + # the unix socket at /cloudsql/<your-cloudsql-connection string> |
| 99 | + DATABASES = { |
| 100 | + 'default': { |
| 101 | + 'ENGINE': 'django.db.backends.mysql', |
| 102 | + 'HOST': '/cloudsql/<your-cloudsql-connection-string>', |
| 103 | + 'NAME': 'polls', |
| 104 | + 'USER': '<your-database-user>', |
| 105 | + 'PASSWORD': '<your-database-password>', |
| 106 | + } |
| 107 | + } |
| 108 | +else: |
| 109 | + # Running locally so connect to either a local MySQL instance or connect to |
| 110 | + # Cloud SQL via the proxy. To start the proxy via command line: |
| 111 | + # |
| 112 | + # $ cloud_sql_proxy -instances=[INSTANCE_CONNECTION_NAME]=tcp:3306 |
| 113 | + # |
| 114 | + # See https://cloud.google.com/sql/docs/mysql-connect-proxy |
| 115 | + DATABASES = { |
| 116 | + 'default': { |
| 117 | + 'ENGINE': 'django.db.backends.mysql', |
| 118 | + 'HOST': '127.0.0.1', |
| 119 | + 'PORT': '3306', |
| 120 | + 'NAME': 'polls', |
| 121 | + 'USER': '<your-database-user>', |
| 122 | + 'PASSWORD': '<your-database-password>', |
| 123 | + } |
| 124 | + } |
| 125 | +# [END db_setup] |
| 126 | + |
| 127 | +# Internationalization |
| 128 | +# https://docs.djangoproject.com/en/1.8/topics/i18n/ |
| 129 | + |
| 130 | +LANGUAGE_CODE = 'en-us' |
| 131 | + |
| 132 | +TIME_ZONE = 'UTC' |
| 133 | + |
| 134 | +USE_I18N = True |
| 135 | + |
| 136 | +USE_L10N = True |
| 137 | + |
| 138 | +USE_TZ = True |
| 139 | + |
| 140 | + |
| 141 | +# Static files (CSS, JavaScript, Images) |
| 142 | +# https://docs.djangoproject.com/en/1.8/howto/static-files/ |
| 143 | + |
| 144 | +STATIC_ROOT = 'static' |
| 145 | +STATIC_URL = '/static/' |
0 commit comments