1
0
Fork 0
satnogs-db/db/settings.py

522 lines
18 KiB
Python
Raw Normal View History

"""SatNOGS DB Application django settings
For local installation settings please copy .env-dist to .env and edit
the appropriate settings in that file. You should not need to edit this
file for local settings!
"""
from pathlib import Path
2018-12-09 02:29:11 -07:00
import sentry_sdk
from decouple import Csv, config
from dj_database_url import parse as db_url
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from db import __version__
ROOT = Path(__file__).parent
2015-04-22 05:05:30 -06:00
ENVIRONMENT = config('ENVIRONMENT', default='dev')
DEBUG = config('DEBUG', default=True, cast=bool)
2018-11-17 13:11:35 -07:00
AUTH0 = config('AUTH0', default=False, cast=bool)
2017-05-08 08:29:56 -06:00
2015-04-22 05:05:30 -06:00
# Apps
DJANGO_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
)
THIRD_PARTY_APPS = (
2017-03-02 10:55:10 -07:00
'avatar',
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
'bootstrap_modal_forms',
2015-04-22 05:05:30 -06:00
'rest_framework',
2017-03-02 10:55:10 -07:00
'rest_framework.authtoken',
'drf_spectacular',
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
'django_countries',
'django_filters',
'fontawesomefree',
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
'widget_tweaks',
2015-04-22 05:05:30 -06:00
'allauth',
'allauth.account',
'allauth.socialaccount',
2015-04-22 05:05:30 -06:00
'crispy_forms',
2015-09-15 04:32:07 -06:00
'compressor',
2017-02-21 10:22:39 -07:00
'csp',
"corsheaders",
2015-04-22 05:05:30 -06:00
)
LOCAL_APPS = (
'db.base',
'db.api',
)
2018-11-17 13:11:35 -07:00
if DEBUG:
DJANGO_APPS += ('debug_toolbar', )
DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': lambda request: request.environ.get('SERVER_NAME', None) != # noqa W504 pylint: disable=C0301
'testserver',
}
2018-11-17 13:11:35 -07:00
if AUTH0:
THIRD_PARTY_APPS += ('social_django', )
2018-11-17 13:11:35 -07:00
2015-04-22 05:05:30 -06:00
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# Middlware
MIDDLEWARE = (
2015-04-22 05:05:30 -06:00
'django.contrib.sessions.middleware.SessionMiddleware',
'corsheaders.middleware.CorsMiddleware',
2015-04-22 05:05:30 -06:00
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
2017-02-21 10:22:39 -07:00
'csp.middleware.CSPMiddleware',
2015-04-22 05:05:30 -06:00
)
if DEBUG:
MIDDLEWARE = ('debug_toolbar.middleware.DebugToolbarMiddleware', ) + MIDDLEWARE
2015-04-22 05:05:30 -06:00
# Email
2017-05-08 08:29:56 -06:00
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
else:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = config('EMAIL_HOST', default='localhost')
EMAIL_PORT = config('EMAIL_PORT', default=25, cast=int)
EMAIL_TIMEOUT = config('EMAIL_TIMEOUT', default=300, cast=int)
EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=False, cast=bool)
EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='')
2018-01-06 04:25:23 -07:00
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', default='noreply@satnogs.org')
ADMINS = [('SatNOGS Admins', DEFAULT_FROM_EMAIL)]
2015-04-22 05:05:30 -06:00
MANAGERS = ADMINS
2017-05-08 08:29:56 -06:00
SERVER_EMAIL = DEFAULT_FROM_EMAIL
2015-04-22 05:05:30 -06:00
# Cache
CACHES = {
'default': {
'BACKEND': config(
'CACHE_BACKEND',
default='django.core.cache.backends.locmem.LocMemCache',
),
'LOCATION': config('CACHE_LOCATION', default='unique-location'),
2017-05-08 08:29:56 -06:00
'KEY_PREFIX': 'db-{0}'.format(ENVIRONMENT),
2015-04-22 05:05:30 -06:00
}
}
if CACHES['default']['BACKEND'] == 'django.core.cache.backends.locmem.LocMemCache':
CACHES['default']['OPTIONS'] = {'MAX_ENTRIES': 5000}
2018-01-06 04:25:23 -07:00
CACHE_TTL = config('CACHE_TTL', default=300, cast=int)
2015-04-22 05:05:30 -06:00
# Internationalization
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Templates
2016-02-03 13:14:07 -07:00
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
Path(ROOT).joinpath('templates').resolve(),
],
2016-02-03 13:14:07 -07:00
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
'db.base.context_processors.analytics', 'db.base.context_processors.stage_notice',
'db.base.context_processors.auth_block', 'db.base.context_processors.logout_block',
'db.base.context_processors.version',
'db.base.context_processors.decoders_version',
'db.base.context_processors.login_button'
2016-02-03 13:14:07 -07:00
],
'loaders': [
(
'django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]
),
2016-02-03 13:14:07 -07:00
],
},
},
]
2015-04-22 05:05:30 -06:00
# Static & Media
STATIC_ROOT = config('STATIC_ROOT', default=Path('staticfiles').resolve())
STATIC_URL = config('STATIC_URL', default='/static/')
STATICFILES_DIRS = [
Path(ROOT).joinpath('static').resolve(),
]
2015-04-22 05:05:30 -06:00
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
2015-09-15 04:32:07 -06:00
'compressor.finders.CompressorFinder',
2015-04-22 05:05:30 -06:00
)
MEDIA_ROOT = config('MEDIA_ROOT', default=Path('media').resolve())
FILE_UPLOAD_TEMP_DIR = config('FILE_UPLOAD_TEMP_DIR', default=Path('/tmp').resolve())
FILE_UPLOAD_PERMISSIONS = 0o644
MEDIA_URL = config('MEDIA_URL', default='/media/')
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
CRISPY_TEMPLATE_PACK = 'bootstrap4'
SATELLITE_DEFAULT_IMAGE = '/static/img/sat_purple.png'
2018-01-06 04:25:23 -07:00
COMPRESS_ENABLED = config('COMPRESS_ENABLED', default=False, cast=bool)
COMPRESS_OFFLINE = config('COMPRESS_OFFLINE', default=False, cast=bool)
COMPRESS_CACHE_BACKEND = config('COMPRESS_CACHE_BACKEND', default='default')
COMPRESS_FILTERS = {
'css': [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.rCSSMinFilter'
],
'js': ['compressor.filters.jsmin.JSMinFilter']
}
2015-04-22 05:05:30 -06:00
# App conf
ROOT_URLCONF = 'db.urls'
WSGI_APPLICATION = 'db.wsgi.application'
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
2015-04-22 05:05:30 -06:00
# Auth
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', )
2018-11-17 13:11:35 -07:00
if AUTH0:
AUTHENTICATION_BACKENDS += ('social_core.backends.auth0.Auth0OAuth2', )
2018-11-17 13:11:35 -07:00
2015-04-22 05:05:30 -06:00
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
LOGIN_REDIRECT_URL = 'home'
if AUTH0:
LOGIN_URL = '/login/auth0'
LOGOUT_REDIRECT_URL = 'https://' + config('SOCIAL_AUTH_AUTH0_DOMAIN') + \
'/v2/logout?returnTo=' + config('SITE_URL')
else:
LOGIN_URL = 'account_login'
LOGOUT_REDIRECT_URL = '/'
2015-04-22 05:05:30 -06:00
# Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
2015-07-17 11:22:07 -06:00
'formatters': {
'verbose': {
2015-07-17 11:59:23 -06:00
'format': '%(levelname)s %(asctime)s %(module)s - %(process)d %(thread)d - %(message)s'
2015-07-17 11:22:07 -06:00
},
},
2015-04-22 05:05:30 -06:00
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
2015-07-17 11:22:07 -06:00
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
2015-04-22 05:05:30 -06:00
},
'loggers': {
'django.request': {
'level': 'ERROR',
'handlers': ['console'],
2015-09-17 05:33:13 -06:00
'propagate': False,
2015-04-22 05:05:30 -06:00
},
2015-07-17 11:22:07 -06:00
'django.db.backends': {
'level': 'ERROR',
'handlers': ['console'],
2015-07-17 11:22:07 -06:00
'propagate': False,
},
'db': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': False,
},
2015-04-22 05:05:30 -06:00
}
}
2018-12-09 02:29:11 -07:00
# Sentry
SENTRY_ENABLED = config('SENTRY_ENABLED', default=False, cast=bool)
2018-12-09 02:29:11 -07:00
if SENTRY_ENABLED:
sentry_sdk.init( # pylint: disable=abstract-class-instantiated
environment=ENVIRONMENT,
dsn=config('SENTRY_DSN', default=''),
release='satnogs-db@{}'.format(__version__),
integrations=[CeleryIntegration(),
DjangoIntegration(),
RedisIntegration()]
)
2018-12-09 02:29:11 -07:00
# Celery
CELERY_ENABLE_UTC = USE_TZ
CELERY_TIMEZONE = TIME_ZONE
CELERY_TASK_RESULTS_EXPIRES = 3600
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_SEND_TASK_ERROR_EMAILS = True
CELERY_TASK_ALWAYS_EAGER = False
2017-05-08 08:29:56 -06:00
CELERY_DEFAULT_QUEUE = 'db-{0}-queue'.format(ENVIRONMENT)
2018-01-06 04:25:23 -07:00
CELERY_BROKER_URL = config('CELERY_BROKER_URL', default='redis://redis:6379/0')
CELERY_RESULT_BACKEND = config('CELERY_RESULT_BACKEND', default='redis://redis:6379/0')
CELERY_BROKER_TRANSPORT_OPTIONS = {
'visibility_timeout': config('REDIS_VISIBILITY_TIMEOUT', default=604800, cast=int),
'fanout_prefix': True
}
REDIS_CONNECT_RETRY = True
2015-04-22 05:05:30 -06:00
# API
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
),
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication'
],
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend', ),
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}
SPECTACULAR_SETTINGS = {
'SCHEMA_PATH_PREFIX': r'/api',
'DEFAULT_GENERATOR_CLASS': 'drf_spectacular.generators.SchemaGenerator',
# Configuration for serving the schema with SpectacularAPIView
'SERVE_URLCONF': None,
'SERVE_PUBLIC': True,
'SERVE_INCLUDE_SCHEMA': False,
'SERVE_PERMISSIONS': ['rest_framework.permissions.AllowAny'],
# available SwaggerUI configuration parameters
# https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/
'SWAGGER_UI_SETTINGS': {
'deepLinking': True,
'persistAuthorization': True,
'displayOperationId': True,
},
# we pull swagger-ui in via npm, as opposed to using their cdn
'SWAGGER_UI_DIST': STATIC_URL + 'lib/swagger-ui-dist',
'SWAGGER_UI_FAVICON_HREF': STATIC_URL + 'favicon.ico',
'TITLE': 'SatNOGS DB',
'DESCRIPTION': 'SatNOGS DB is a crowdsourced database of details about orbital \
satellites and data collected from them.',
'TOS': None,
'CONTACT': {
'name': 'SatNOGS Developer Chat',
'url': 'https://riot.im/app/#/room/#satnogs-dev:matrix.org'
},
'LICENSE': {
'name': 'AGPL 3.0',
'url': 'https://www.gnu.org/licenses/agpl-3.0.html'
},
'VERSION': '1.1',
'SERVERS': [
{
'url': 'https://db-dev.satnogs.org',
'description': 'Development server'
}, {
'url': 'https://db.satnogs.org',
'description': 'Production server'
}
],
'PREPROCESSING_HOOKS': [
'drf_spectacular.hooks.preprocess_exclude_path_format',
'db.api.drf_spectacular_hooks.exclude_paths_hook'
],
'POSTPROCESSING_HOOKS': ['drf_spectacular.hooks.postprocess_schema_enums'],
'GET_MOCK_REQUEST': 'drf_spectacular.plumbing.build_mock_request',
# Tags defined in the global scope
'TAGS': [
{
'name': 'artifacts',
'description': 'IN DEVELOPMENT (BETA): Artifacts are file-formatted objects \
collected from a satellite observation.'
},
{
'name': 'modes',
'description': 'Radio Frequency modulation modes (RF Modes) currently \
tracked in the SatNOGS DB database',
'externalDocs': {
'description': 'RF Modes in SatNOGS Wiki',
'url': 'https://wiki.satnogs.org/Category:RF_Modes',
}
},
{
'name': 'satellites',
'description': 'Human-made orbital objects, typically with radio frequency \
transmitters and/or reveivers'
},
{
'name': 'telemetry',
'description': 'Telemetry objects in the SatNOGS DB database are frames of \
data collected from downlinked observations.'
},
{
'name': 'tle',
'description': 'The most recent two-line elements (TLE) in the SatNOGS DB database',
'externalDocs': {
'description': 'TLE Wikipedia doc',
'url': 'https://en.wikipedia.org/wiki/Two-line_element_set',
}
},
{
'name': 'transmitters',
'description': 'Radio Frequency (RF) transmitter entities in the SatNOGS DB \
database. Transmitters in this case are inclusive of Transceivers \
and Transponders'
},
],
'EXTERNAL_DOCS': {
'url': 'https://wiki.satnogs.org',
'description': 'SatNOGS Wiki'
},
'COMPONENT_SPLIT_REQUEST': True
2015-04-22 05:05:30 -06:00
}
# Security
2018-01-06 04:25:23 -07:00
SECRET_KEY = config('SECRET_KEY', default='changeme')
SECURE_HSTS_SECONDS = config('SECURE_HSTS_SECONDS', default=31536000, cast=int)
CORS_ALLOW_ALL_ORIGINS = config('CORS_ALLOW_ALL_ORIGINS', default=True, cast=bool)
CORS_URLS_REGEX = config('CORS_URLS_REGEX', default=r'^(?:/api/artifacts/.*|/media/artifacts/.*)$')
CORS_ALLOW_METHODS = config('CORS_ALLOW_METHODS', default='GET, OPTIONS', cast=Csv())
CSP_DEFAULT_SRC = config(
'CSP_DEFAULT_SRC',
cast=lambda v: tuple(s.strip() for s in v.split(',')),
default="'self',"
'https://*.mapbox.com,'
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
'https://kit-free.fontawesome.com,'
'https://ka-f.fontawesome.com,'
'https://fonts.gstatic.com,'
"'unsafe-inline'"
2017-02-21 10:22:39 -07:00
)
CSP_SCRIPT_SRC = config(
'CSP_SCRIPT_SRC',
cast=lambda v: tuple(s.strip() for s in v.split(',')),
default="'self',"
'https://*.google-analytics.com,'
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
'https://kit-free.fontawesome.com,'
'https://kit.fontawesome.com,'
"'sha256-wMIRCqWVu9YgOwizZzrYvTWAiAn0Y8PQTRdiHy2BNRk='," # transmitter_modal.js
2017-02-21 10:22:39 -07:00
)
CSP_IMG_SRC = config(
'CSP_IMG_SRC',
cast=lambda v: tuple(s.strip() for s in v.split(',')),
default="'self',"
'https://*.gravatar.com,'
'https://*.mapbox.com,'
'https://*.google-analytics.com,'
'data:,'
'blob:'
)
CSP_FRAME_SRC = config(
'CSP_FRAME_SRC', cast=lambda v: tuple(s.strip() for s in v.split(',')), default='blob:'
2017-03-02 10:55:10 -07:00
)
New SatNOGS DB user interface Initial commit of new UI. There is still some work to be done before this goes into dev, but here is the work so far: * Updated dependencies to latest 2.x django * Updated to Bootstrap 4 * New home screen to display most recent satellite entries, most recent data, and contributors * Adopted django-bootstrap-modal-forms for handling satellite and transmitter creation and update, with more of an emphasis on django's model/view/form model - and a dynamic flow where the modals and details are only loaded when the proper icon is clicked, reducing the overall page size * Adopted AdminLTE 3.x framework atop Bootstrap 4 * Created reusable cards for satellite and transmitters * Cards and Modals are organized into subdirectories for template includes and base templates, respectively * New stats display widgets using BS4 and AdminLTE 3 * Satellite search is redesigned and now accessible from any page of the site * Introduced datatables for an "All Satellites" view and a modification of the new "All Transmitters" view * Focus on all UI scaling down to mobile devices * New model created for Operator (/ Owner): name, names, description, website * Added django-countries for support of CountryField * Satellite model expanded to include: Operator, (satellite) website, countries, launched datetime, deployed datetime * Transmitter suggestions can now be approved in the UI by superusers * Satellite entries can now be edited in the UI by users with the change satellite permission * Satellite page is now broken into 'tabbed' panels (Profile, Map, Transmitters, etc) - with the tab menu options appearing in the sidebar or at the top depending on screen size * Other cleanup and changes that I'm missing for sure. Signed-off-by: Corey Shields <cshields@gmail.com>
2020-07-25 16:08:44 -06:00
CSP_WORKER_SRC = config(
'CSP_WORKER_SRC',
cast=lambda v: tuple(s.strip() for s in v.split(',')),
default="'self',"
'blob:'
)
CSP_CHILD_SRC = config(
'CSP_CHILD_SRC', cast=lambda v: tuple(s.strip() for s in v.split(',')), default='blob:'
)
2017-05-08 08:29:56 -06:00
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
2018-01-06 04:25:23 -07:00
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='localhost', cast=Csv())
2015-04-22 05:05:30 -06:00
# Database
2018-01-06 04:25:23 -07:00
DATABASE_URL = config('DATABASE_URL', default='sqlite:///db.sqlite3')
DATABASES = {'default': db_url(DATABASE_URL)}
# NETWORK API
2018-01-06 04:25:23 -07:00
NETWORK_API_ENDPOINT = config('NETWORK_API_ENDPOINT', default='https://network.satnogs.org/api/')
DATA_FETCH_DAYS = config('DATA_FETCH_DAYS', default=10, cast=int)
# Mapbox API
MAPBOX_GEOCODE_URL = 'https://api.tiles.mapbox.com/v4/geocode/mapbox.places/'
2018-01-06 04:25:23 -07:00
MAPBOX_TOKEN = config('MAPBOX_TOKEN', default='')
2017-05-08 08:29:56 -06:00
# ZEROMQ
ZEROMQ_ENABLE = config('ZEROMQ_ENABLED', default=False, cast=bool)
ZEROMQ_SOCKET_URI = config('ZEROMQ_SOCKET_URI', default='tcp://127.0.0.1:5555')
ZEROMQ_SOCKET_RCVTIMEO = config(
'ZEROMQ_SOCKET_RCVTIMEO', default='100', cast=int
) # Time to wait for subscriber message in ms
# TLE Sources
TLE_SOURCES_REDISTRIBUTABLE = config('TLE_SOURCES_REDISTRIBUTABLE', default='manual', cast=Csv())
TLE_SOURCES_JSON = config('TLE_SOURCES_JSON', default='')
# Comma separated TLE sources name that will be ignored on latest TLE calculations
TLE_SOURCES_IGNORE_FROM_LATEST = config('TLE_SOURCES_IGNORE_FROM_LATEST', default='', cast=Csv())
# SpaceTrack.org Credentials
SPACE_TRACK_USERNAME = config('SPACE_TRACK_USERNAME', default='')
SPACE_TRACK_PASSWORD = config('SPACE_TRACK_PASSWORD', default='')
# Exported Frames
EXPORTED_FRAMESET_TIME_TO_LIVE = config('EXPORTED_FRAMESET_TIME_TO_LIVE', default=21600, cast=int)
# Influx DB for decoded data_id
USE_INFLUX = config('USE_INFLUX', default=False, cast=bool)
INFLUX_HOST = config('INFLUX_HOST', default='localhost')
INFLUX_PORT = config('INFLUX_PORT', default='8086')
INFLUX_USER = config('INFLUX_USER', default='db')
INFLUX_PASS = config('INFLUX_PASS', default='db')
INFLUX_DB = config('INFLUX_DB', default='db')
INFLUX_SSL = config('INFLUX_SSL', default=False, cast=bool)
INFLUX_VERIFY_SSL = config('INFLUX_VERIFY_SSL', default=False, cast=bool)
2018-11-17 13:11:35 -07:00
if AUTH0:
SOCIAL_AUTH_TRAILING_SLASH = False # Remove end slash from routes
2018-11-17 13:11:35 -07:00
SOCIAL_AUTH_AUTH0_DOMAIN = config('SOCIAL_AUTH_AUTH0_DOMAIN', default='YOUR_AUTH0_DOMAIN')
SOCIAL_AUTH_AUTH0_KEY = config('SOCIAL_AUTH_AUTH0_KEY', default='YOUR_CLIENT_ID')
SOCIAL_AUTH_AUTH0_SECRET = config('SOCIAL_AUTH_AUTH0_SECRET', default='YOUR_CLIENT_SECRET')
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
2018-11-17 13:11:35 -07:00
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['email', 'first_name', 'last_name']
SOCIAL_AUTH_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.social_auth.associate_by_email',
'social_core.pipeline.user.get_username',
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
)
SOCIAL_AUTH_AUTH0_SCOPE = [
'openid',
'email',
'profile',
]
2017-11-13 03:30:39 -07:00
if ENVIRONMENT == 'dev':
# Disable template caching
for backend in TEMPLATES:
del backend['OPTIONS']['loaders']
backend['APP_DIRS'] = True
# for h5 artifact uploads
DATA_UPLOAD_MAX_MEMORY_SIZE = 5242880
# Django 3.2 allows for configurable db keys, we just need auto
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'