forked from uishon/Sefaria-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_settings.py
277 lines (234 loc) · 8.23 KB
/
local_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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#An example of settings needed in a local_settings.py file which is ignored by git.
# copy this file to sefaria/local_settings.py and provide local info to run_atomic.
import os.path
from datetime import timedelta
relative_to_abs_path = lambda *x: os.path.join(os.path.dirname(
os.path.realpath(__file__)), *x)
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "0.0.0.0", "shitufta-ec2", "*"]
DEBUG = True
TEMPLATE_DEBUG = DEBUG
OFFLINE = False
DOWN_FOR_MAINTENANCE = False
MAINTENANCE_MESSAGE = ""
GLOBAL_WARNING = False
GLOBAL_WARNING_MESSAGE = ""
GLOBAL_INTERRUPTING_MESSAGE = None
ADMINS = (
('You', 'you@yours.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/db/db.sqlite', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://redis:6379/0",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
#"PASSWORD": "secretpassword", # Optional
},
"TIMEOUT": 60 * 60 * 24 * 30,
}
}
SITE_PACKAGE = "sites.sefaria"
SECRET_KEY = 'insert your long random secret key here !'
STATICFILES_DIRS = (
'/www/static/',
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
TEMPLATE_DIRS = (
'/www/templates/',
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
SEFARIA_EXPORT_PATH = '/export'
# Map domain to an interface language that the domain should be pinned to
DOMAIN_LANGUAGES = {}
# Map domains which should be allowed for language directs, same shape as DOMAIN_LANGUAGES.
# Set if you need to redirects to behave differently.
REDIRECTABLE_DOMAIN_LANGUAGES = DOMAIN_LANGUAGES
DJANGO_HOST = "http://localhost:8000" # Where is Django running
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
MONGO_HOST = "mongo"
MONGO_PORT = 27017
# Name of the MongoDB datebase to use.
SEFARIA_DB = 'sefaria'
# Leave user and password blank if not using Mongo Auth
SEFARIA_DB_USER = ''
SEFARIA_DB_PASSWORD = ''
# ElasticSearch server
# SEARCH_HOST = "http://localhost:9200"
# SEARCH_ADMIN = "http://localhost:9200"
# SEARCH_INDEX_ON_SAVE = True # Whether to send texts and source sheet to Search Host for indexing after save
# SEARCH_INDEX_NAME = 'sefaria' # name of the ElasticSearch index to use
SEARCH_HOST = "http://search.sefaria.org"
SEARCH_ADMIN = "http://localhost:9200"
SEARCH_ADMIN_USER = None # if not None, use these credentials to access SEARCH_ADMIN
SEARCH_ADMIN_PW = None
SEARCH_ADMIN_K8S = "http://localhost:9200"
SEARCH_INDEX_ON_SAVE = False # Whether to send texts and source sheet to Search Host for indexing after save
SEARCH_INDEX_NAME = 'sefaria' # name of the ElasticSearch index to use
SEARCH_INDEX_NAME_TEXT = 'text' # name of the ElasticSearch index to use
SEARCH_INDEX_NAME_SHEET = 'sheet'
SEARCH_INDEX_NAME_MERGED = 'merged'
# Node Server
USE_NODE = False
NODE_HOST = "http://localhost:4040"
NODE_TIMEOUT = 10
NODE_TIMEOUT_MONITOR = relative_to_abs_path("../log/forever/timeouts")
SEFARIA_DATA_PATH = '/export' # used for exporting texts
GOOGLE_ANALYTICS_CODE = 'FOOBAR'
# Integration with a NationBuilder list
NATIONBUILDER = False
NATIONBUILDER_SLUG = ""
NATIONBUILDER_TOKEN = ""
NATIONBUILDER_CLIENT_ID = ""
NATIONBUILDER_CLIENT_SECRET = ""
# Issue bans to Varnish on update.
USE_VARNISH = False
FRONT_END_URL = "http://localhost:8000"
VARNISH_ADM_ADDR = "localhost:6082"
VARNISH_FRNT_PORT = 8040
VARNISH_SECRET = "/etc/varnish/secret"
# Use ESI for user box in header.
USE_VARNISH_ESI = True
# Prevent modification of Index records
DISABLE_INDEX_SAVE = False
# Caching with Cloudflare
CLOUDFLARE_ZONE = ""
CLOUDFLARE_EMAIL = ""
CLOUDFLARE_TOKEN = ""
MIXPANEL_CODE = None
RECAPTCHA_PUBLIC_KEY = "Dummy"
RECAPTCHA_PRIVATE_KEY = "Dummy"
# Multiserver
MULTISERVER_ENABLED = False
MULTISERVER_REDIS_SERVER = "127.0.0.1"
MULTISERVER_REDIS_PORT = 6379
MULTISERVER_REDIS_DB = 0
MULTISERVER_REDIS_EVENT_CHANNEL = "msync" # Message queue on Redis
MULTISERVER_REDIS_CONFIRM_CHANNEL = "mconfirm" # Message queue on Redis
# OAUTH these fields dont need to be filled in. they are only required for oauth2client to __init__ successfully
GOOGLE_OAUTH2_CLIENT_ID = ""
GOOGLE_OAUTH2_CLIENT_SECRET = ""
GOOGLE_MAPS_API_KEY = ""
# This is the field that is actually used
GOOGLE_OAUTH2_CLIENT_SECRET_FILEPATH = ""
GEOIP_DATABASE = 'data/geoip/GeoLiteCity.dat'
GEOIPV6_DATABASE = 'data/geoip/GeoLiteCityv6.dat'
PARTNER_GROUP_EMAIL_PATTERN_LOOKUP_FILE = None
# Simple JWT
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(days=1),
'REFRESH_TOKEN_LIFETIME': timedelta(days=90),
'ROTATE_REFRESH_TOKENS': True,
'SIGNING_KEY': 'a signing key: at least 256 bits',
}
# Key which identifies the Sefaria app as opposed to a user
# using our API outside of the app. Mainly for registration
MOBILE_APP_KEY = "MOBILE_APP_KEY"
""" to use logging, in any module:
# import the logging library
import logging
# Get an instance of a logger
logger = logging.getLogger(__name__)
#log stuff
logger.critical()
logger.error()
logger.warning()
logger.info()
logger.debug()
if you are logging to a file, make sure the directory exists and is writeable by the server.
"""
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': u'%(asctime)s - %(levelname)s %(name)s: %(message)s'
},
'simple': {
'format': u'%(levelname)s %(message)s'
},
'verbose': {
'format': u'%(asctime)s - %(levelname)s: [%(name)s] %(process)d %(thread)d %(message)s'
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
},
},
'handlers': {
'default': {
'level':'INFO',
'class':'logging.handlers.RotatingFileHandler',
'filename': relative_to_abs_path('../log/sefaria.log'),
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter':'standard',
},
'custom_debug' :{
'level':'DEBUG',
'class':'logging.handlers.RotatingFileHandler',
'filename': relative_to_abs_path('../log/debug.log'),
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter':'verbose',
'filters': [],
},
'console':{
'level':'INFO',
'class':'logging.StreamHandler',
'formatter': 'simple',
'filters': [],
},
'null': {
'level':'INFO',
'class':'logging.NullHandler',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'request_handler': {
'level':'INFO',
'class':'logging.handlers.RotatingFileHandler',
'filename': relative_to_abs_path('../log/django_request.log'),
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 20,
'formatter':'standard',
}
},
'loggers': {
'': {
'handlers': ['default', 'console', 'custom_debug'],
'level': 'DEBUG',
'propagate': True
},
'django': {
'handlers': ['null'],
'propagate': False,
'level': 'INFO',
},
'django.request': {
'handlers': ['mail_admins', 'request_handler'],
'level': 'INFO',
'propagate': True,
},
}
}