Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If you have a large number of data sources, you may exceed 2.5MB #414

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 114 additions & 117 deletions sal/system_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
DEBUG = False
APPEND_SLASH = True
PROJECT_DIR = os.path.abspath(
os.path.join(
os.path.dirname(
os.path.abspath(__file__)
), os.path.pardir))
PLUGIN_DIR = os.path.join(PROJECT_DIR, 'plugins')
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.path.pardir)
)
PLUGIN_DIR = os.path.join(PROJECT_DIR, "plugins")
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)

AUTH_PROFILE_MODULE = "sal.UserProfile"
DISPLAY_NAME = 'Sal'
DISPLAY_NAME = "Sal"
MANAGERS = ADMINS
DEPLOYED_ON_CHECKIN = False
ADD_TO_ALL_BUSINESS_UNITS = False
Expand All @@ -26,41 +24,41 @@
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(PROJECT_DIR, 'templates'),
os.path.join(PROJECT_DIR, 'server', 'plugins'),
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
os.path.join(PROJECT_DIR, "templates"),
os.path.join(PROJECT_DIR, "server", "plugins"),
PLUGIN_DIR,
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'sal.context_processors.display_name',
'sal.context_processors.sal_version',
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"sal.context_processors.display_name",
"sal.context_processors.sal_version",
],
'debug': DEBUG,
'autoescape': True,
"debug": DEBUG,
"autoescape": True,
},
},
]

# The order plugins (if they're able to be shown on that particular page) will be displayed in.
# If not listed here, will be listed alphabetically after.
PLUGIN_ORDER = [
'Activity',
'Status',
'OperatingSystem',
'MunkiVersion',
'Uptime',
'Memory',
'DiskSpace',
'PendingAppleUpdates',
'Pending3rdPartyUpdates',
'PuppetStatus'
"Activity",
"Status",
"OperatingSystem",
"MunkiVersion",
"Uptime",
"Memory",
"DiskSpace",
"PendingAppleUpdates",
"Pending3rdPartyUpdates",
"PuppetStatus",
]

# Only show these plugins on the front page - some things only the admins should see.
Expand Down Expand Up @@ -93,25 +91,25 @@

# Facts to not be displayed on the Machine Information page
EXCLUDED_FACTS = {
'sshrsakey',
'sshfp_rsa',
'sshfp_dsa',
'sshdsakey',
"sshrsakey",
"sshfp_rsa",
"sshfp_dsa",
"sshdsakey",
}

# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = ["*"]

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/London'
TIME_ZONE = "Europe/London"

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"

SITE_ID = 1

Expand All @@ -128,83 +126,83 @@

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''
MEDIA_ROOT = ""

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = ''
MEDIA_URL = ""

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
STATIC_ROOT = os.path.join(PROJECT_DIR, "static")

# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
STATIC_URL = "/static/"

# Additional locations of static files
STATICFILES_DIRS = (
# 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.
os.path.join(PROJECT_DIR, 'site_static'),
os.path.join(PROJECT_DIR, "site_static"),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'ppf%ls0f)mzkf#2dl-nbf^8f&=84py=y^u8^z-f559*d36y_@v'
SECRET_KEY = "ppf%ls0f)mzkf#2dl-nbf^8f&=84py=y^u8^z-f559*d36y_@v"

MIDDLEWARE = (
'django.middleware.security.SecurityMiddleware',
'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',
'server.middleware.AddToBU.AddToBU',
'search.current_user.CurrentUserMiddleware',
"django.middleware.security.SecurityMiddleware",
"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",
"server.middleware.AddToBU.AddToBU",
"search.current_user.CurrentUserMiddleware",
)

LOGIN_URL = '/login'
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = "/login"
LOGIN_REDIRECT_URL = "/"

ROOT_URLCONF = 'sal.urls'
ROOT_URLCONF = "sal.urls"

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'sal.wsgi.application'
WSGI_APPLICATION = "sal.wsgi.application"

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'sal',
'server',
'api',
'catalog',
'inventory',
'licenses',
'profiles',
'bootstrap3',
'datatableview',
'search',
'rest_framework',
'django_filters'
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.admin",
"django.contrib.admindocs",
"sal",
"server",
"api",
"catalog",
"inventory",
"licenses",
"profiles",
"bootstrap3",
"datatableview",
"search",
"rest_framework",
"django_filters",
)


Expand Down Expand Up @@ -235,37 +233,34 @@ def get_sal_logging_config():
# Zero out all of Django's logging decisions. It's easier this way.
LOGGING_CONFIG = None
_SAL_LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'sal_format': {
'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt': "%d/%b/%Y %H:%M:%S"
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"sal_format": {
"format": "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
"datefmt": "%d/%b/%Y %H:%M:%S",
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'sal_format'
},
"handlers": {
"console": {"class": "logging.StreamHandler", "formatter": "sal_format"},
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'ERROR',
"loggers": {
"": {
"handlers": ["console"],
"level": "ERROR",
},
'sal': {
'handlers': ['console'],
'level': 'ERROR',
'propagate': False,
"sal": {
"handlers": ["console"],
"level": "ERROR",
"propagate": False,
},
'server': {
'handlers': ['console'],
'level': 'ERROR',
'propagate': False,
"server": {
"handlers": ["console"],
"level": "ERROR",
"propagate": False,
},
# Configure additional Sal apps for logging here.
}
},
}


Expand All @@ -274,29 +269,31 @@ def get_sal_logging_config():


BOOTSTRAP3 = {
'set_placeholder': False,
"set_placeholder": False,
}

if 'DYNO' in os.environ:
if "DYNO" in os.environ:
# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES['default'] = dj_database_url.config() # noqa: F821

DATABASES["default"] = dj_database_url.config() # noqa: F821

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

# Allow all host headers
ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = ["*"]

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'api.auth.ApiKeyAuthentication',
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework.authentication.SessionAuthentication",
"api.auth.ApiKeyAuthentication",
),
'DEFAULT_PERMISSION_CLASSES': ('api.auth.HasRWPermission',),
'DEFAULT_PAGINATION_CLASS':
'rest_framework.pagination.PageNumberPagination',
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
'PAGE_SIZE': 100,
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
"DEFAULT_PERMISSION_CLASSES": ("api.auth.HasRWPermission",),
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination",
"DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema",
"PAGE_SIZE": 100,
"DEFAULT_FILTER_BACKENDS": ("django_filters.rest_framework.DjangoFilterBackend",),
}

DATA_UPLOAD_MAX_MEMORY_SIZE = 5242880
2 changes: 1 addition & 1 deletion sal/version.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>version</key>
<string>4.1.8.2179</string>
<string>4.1.8.2182</string>
</dict>
</plist>