This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
settings.py
223 lines (173 loc) · 5.76 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
"""
Django settings for Kawaz project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
import sys
REPOSITORY_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xd(wr812awpkuu4+7o)#ugb)*a0z!-m^an+m)%ly$l(ses8_g1'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.comments',
'rest_framework',
'permission',
'thumbnailfield',
'roughpages',
'registration',
'crispy_forms',
'kawaz.core.db',
'kawaz.core.utils',
'kawaz.core.personas',
'kawaz.core.publishments',
'kawaz.core.registrations',
'kawaz.core.forms',
'kawaz.core.templatetags',
'kawaz.core.gcal',
'kawaz.apps.announcements',
'kawaz.apps.attachments',
'kawaz.apps.profiles',
'kawaz.apps.projects',
'kawaz.apps.events',
'kawaz.apps.blogs',
'kawaz.apps.recent_activities',
'kawaz.apps.products',
'kawaz.apps.stars',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'roughpages.middleware.RoughpageFallbackMiddleware',
)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'permission.backends.PermissionBackend',
)
ROOT_URLCONF = 'kawaz.urls'
WSGI_APPLICATION = 'kawaz.wsgi.application'
# validation_on_save decorator (kawaz.core.db.decorators)
# To disable automatical validation, set this variable to False
VALIDATE_ON_SAVE_DISABLE = False
AUTH_USER_MODEL = 'personas.Persona'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(REPOSITORY_ROOT, 'db.sqlite3'),
}
}
THUMBNAIL_SIZE_PATTERNS = {
'huge': (288, 288,),
'large': (96, 96,),
'middle': (48, 48,),
'small': (24, 24,),
}
PRODUCT_THUMBNAIL_SIZE_PATTERNS = {
None : (32, 32),
}
ADVERTISEMENT_IMAGE_SIZE_PATTERNS = {
None : (32, 32),
}
SCREENSHOT_IMAGE_SIZE_PATTERNS = {
None : (32, 32),
}
# Permission presence check in DEBUG mode
# from django-permission 0.5.3
PERMISSION_CHECK_PERMISSION_PRESENCE = DEBUG
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Tokyo'
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = os.path.abspath(os.path.join(REPOSITORY_ROOT, 'storage'))
MEDIA_URL = '/storage/'
TEMPLATE_DIRS = (
os.path.join(REPOSITORY_ROOT, 'src', 'kawaz', 'templates'),
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request"
)
LOGIN_URL = '/registration/login/'
LOGOUT_URL = '/registration/logout/'
LOGIN_REDIRECT_URL = '/'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/statics/'
STATICFILES_DIRS = (
os.path.join(REPOSITORY_ROOT, 'src', 'kawaz', 'statics'),
)
# inspectional-registration
REGISTRATION_SUPPLEMENT_CLASS = (
'kawaz.core.registrations.models.RegistrationSupplement')
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_DJANGO_AUTH_URLS_ENABLE = False
# rest-framework
DEFAULT_RENDERER_CLASSES = (
'rest_framework.renderers.JSONRenderer',
)
TEST_RUNNER = 'kawaz.core.tests.runner.MediaRootTestSuiteRunner'
RECENT_ACTIVITY_FEED_URL = 'http://kawazinfo.hateblo.jp/rss'
SITE_ID = 1
# Google Calendar Synchronize
GCAL_CALENDAR_ID = (
# DEBUG用カレンダー
'kawaz.org_u41faouova38rcoh8eaimbg42c@group.calendar.google.com'
)
GCAL_EVENT_MODEL = 'events.Event'
GCAL_BACKEND_CLASS = 'kawaz.apps.events.gcal.KawazGoogleCalendarBackend'
GCAL_CLIENT_SECRETS = os.path.join(
REPOSITORY_ROOT, 'src', 'kawaz', 'config', 'gcal', 'client_secrets.json')
GCAL_CREDENTIALS = os.path.join(
REPOSITORY_ROOT, 'src', 'kawaz', 'config', 'gcal', 'credentials.json')
# crispy-forms
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap3', 'crispy')
if DEBUG:
# テスト時のRuntimeWarningをexceptionにしている
# https://docs.djangoproject.com/en/dev/topics/i18n/timezones/#code
import warnings
warnings.filterwarnings(
'error', r"DateTimeField .* received a naive datetime",
RuntimeWarning, r'django\.db\.models\.fields')
# 環境依存の設定(デプロイサーバー固有の設定など)を読み込む
LOCAL_SETTINGS_LOADED = False
# DjangoのMessageをBootstrap3に適応させている
from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
messages.ERROR: 'danger'
}
if not 'test' in sys.argv:
try:
from .local_settings import *
except ImportError:
pass