forked from PDXostc/rvi_backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
263 lines (213 loc) · 6.45 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
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
"""
Copyright (C) 2014, Jaguar Land Rover
This program is licensed under the terms and conditions of the
Mozilla Public License, version 2.0. The full text of the
Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
Maintainer: Rudolf Streif ([email protected])
"""
"""
Django settings for rvi project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
#BASE_DIR = os.path.dirname(os.path.dirname(__file__))
BASE_DIR = os.path.dirname(__file__)
WEB_DIR = os.path.join(BASE_DIR, 'web')
# Templates
TEMPLATE_DIRS = [os.path.join(WEB_DIR, 'templates')]
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'y7pg3qz)6fs4vk4=)_*fn(dagsx+t!wvl=p&d3ybm(yc%((&pg'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = False
# We allow all hosts to connect
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = (
'django_admin_bootstrapped',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap3',
'leaflet',
'djgeojson',
'rvi',
'vehicles',
'sota',
'dblog',
'tracking',
)
#INSTALLED_APPS = ('django_cassandra_engine',) + INSTALLED_APPS
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
ROOT_URLCONF = 'rvi.urls'
WSGI_APPLICATION = 'rvi.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'rvi',
'USER': 'rvi_user',
'PASSWORD': 'rvi',
'CHARSET': 'utf8',
},
}
"""
DATABASES = {
'default': {
'ENGINE': 'django_cassandra_engine',
'NAME': 'rvi',
'HOST': 'localhost',
'OPTIONS': {
'replication': {
'strategy_class': 'SimpleStrategy',
'replication_factor': 1,
},
},
},
}
"""
# Logging
# https://docs.djangoproject.com/en/1.7/topics/logging/
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'simple',
},
'file': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': os.path.join(BASE_DIR, 'log/rvibackend.log'),
'formatter': 'verbose',
},
'db_general': {
'level': 'INFO',
'class': 'dblog.handlers.DBHandler',
'model': 'dblog.models.GeneralLog',
'expiry': 0,
'formatter': 'verbose',
},
'db_sota': {
'level': 'INFO',
'class': 'dblog.handlers.SotaHandler',
'model': 'dblog.models.SotaLog',
'expiry': 0,
'formatter': 'verbose',
},
},
'loggers': {
'django.request': {
'handlers': ['db_general', 'file'],
'level': 'DEBUG',
'propagate': True,
},
'rvi': {
'handlers': ['db_general', 'file'],
'level': 'DEBUG',
'propagate': False,
},
'rvi.sota': {
'handlers': ['db_sota', 'file'],
'level': 'DEBUG',
'propagate': True,
},
'tools': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': False,
},
},
}
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATICFILES_DIRS = (
os.path.join(WEB_DIR, 'static'),
)
STATIC_ROOT = os.path.join(WEB_DIR, 'staticroot')
STATIC_URL = '/static/'
# Email configuration
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Bootstrap 3 Configuration
BOOTSTRAP3 = {
'jquery_url': '//code.jquery.com/jquery-2.1.1.min.js',
'base_url': '//netdna.bootstrapcdn.com/bootstrap/3.2.0/',
'css_url': None,
'theme_url': None,
'javascript_url': None,
'javascript_in_head': False,
'include_jquery': True,
}
# File upload base path
# You can use the relative path when running the rviserver in the foreground.
# For running as a daemon you must use an absolute path.
MEDIA_ROOT = os.path.join(BASE_DIR, 'files')
#MEDIA_ROOT = '/absolute/path/to/files/'
MEDIA_URL = '/files/'
DEFAULT_VEHICLE_IMAGE = "car-100x50.png"
# Mapping Configuration
LEAFLET_CONFIG = {
'TILES': 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'MINIMAP': True,
}
LEAFLET_ANIMATION_INTERVAL = "100"
# RVI Server Daemon Configuration
RVI_DB_PING_INTERVAL = 10
RVI_DB_CLOSE_TIMEOUT = 3600
RVI_SERVICE_EDGE_URL = 'http://127.0.0.1:8801'
# SOTA
RVI_SOTA_ENABLE = True
RVI_SOTA_CALLBACK_URL = 'http://127.0.0.1:20001'
RVI_SOTA_SERVICE_ID = '/sota'
RVI_SOTA_CHUNK_SIZE = 65536
# Tracking
RVI_TRACKING_SOURCE_GPS = True
RVI_TRACKING_ENABLE = True
RVI_TRACKING_CALLBACK_URL = 'http://127.0.0.1:20002'
RVI_TRACKING_SERVICE_ID = '/logging'
RVI_TRACKING_DB_PUBLISH = False
RVI_TRACKING_MQ_PUBLISH = True
RVI_TRACKING_MQ_URL = "192.168.100.144:9092"
RVI_TRACKING_MQ_REPORT_FLAT = True
#RVI_TRACKING_MQ_TOPIC = "rvi"
RVI_TRACKING_MQ_TOPIC = "gps_trace"