Cleanup settings
This commit is contained in:
+26
-80
@@ -7,24 +7,40 @@ from django.utils.translation import ugettext_lazy as _
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
||||
STATICFILES_FINDERS = (
|
||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
||||
)
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "collected_static")
|
||||
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = "/media/"
|
||||
|
||||
# Login paths
|
||||
LOGIN_URL = "/login/"
|
||||
LOGIN_REDIRECT_URL = "/admin"
|
||||
|
||||
SUIT_CONFIG = {
|
||||
"ADMIN_NAME": "SIK Admin",
|
||||
}
|
||||
|
||||
# Might need to be changed to JSON serializer
|
||||
# https://docs.djangoproject.com/en/4.0/topics/http/sessions/#django.contrib.sessions.serializers.JSONSerializer
|
||||
SESSION_SERIALIZER = "django.contrib.sessions.serializers.PickleSerializer"
|
||||
|
||||
# Logger level
|
||||
|
||||
# Logging
|
||||
LOGGERLEVEL = logging.DEBUG
|
||||
LOGPATH = os.path.join(BASE_DIR, "logs", "debug.log")
|
||||
|
||||
|
||||
def disable_pyexcel_logs(record):
|
||||
if record.module in ["loader", "utils", "source_plugin", "plugin"]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
LOGGING = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
@@ -67,6 +83,11 @@ LOGGING = {
|
||||
|
||||
|
||||
# Application definition
|
||||
IMPORT_EXPORT_USE_TRANSACTIONS = True
|
||||
TEST_RUNNER = "django_nose.NoseTestSuiteRunner"
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
ROOT_URLCONF = "sikweb.urls"
|
||||
WSGI_APPLICATION = "sikweb.wsgi.application"
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"modeltranslation", # has to be before admin for translation admin to work
|
||||
@@ -97,10 +118,6 @@ INSTALLED_APPS = [
|
||||
"django_filters",
|
||||
]
|
||||
|
||||
IMPORT_EXPORT_USE_TRANSACTIONS = True
|
||||
|
||||
TEST_RUNNER = "django_nose.NoseTestSuiteRunner"
|
||||
|
||||
NOSE_ARGS = [
|
||||
"--with-coverage",
|
||||
"--cover-package=webapp,members,infoscreen",
|
||||
@@ -124,10 +141,6 @@ MIDDLEWARE = [
|
||||
"auditlog.middleware.AuditlogMiddleware",
|
||||
]
|
||||
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
|
||||
ROOT_URLCONF = "sikweb.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
@@ -150,11 +163,9 @@ TEMPLATES = [
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "sikweb.wsgi.application"
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation."
|
||||
@@ -180,86 +191,21 @@ REST_FRAMEWORK = {
|
||||
"DEFAULT_AUTHENTICATION_CLASSES": (
|
||||
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
||||
),
|
||||
# 'DEFAULT_THROTTLE_CLASSES': (
|
||||
# 'members.throttles.BurstRateThrottle',
|
||||
# 'members.throttles.SustainedRateThrottle'
|
||||
# ),
|
||||
# 'DEFAULT_THROTTLE_RATES': {
|
||||
# 'burst': '60/min',
|
||||
# 'sustained': '1000/day'
|
||||
# },
|
||||
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
|
||||
"PAGE_SIZE": 1000,
|
||||
"DEFAULT_FILTER_BACKENDS": ("django_filters.rest_framework.DjangoFilterBackend",),
|
||||
}
|
||||
|
||||
# Email settings (tested working with gmail)
|
||||
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
# EMAIL_USE_TLS = True
|
||||
# EMAIL_HOST = 'smtp.gmail.com'
|
||||
# EMAIL_PORT = 587
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
||||
|
||||
LANGUAGES = (
|
||||
("fi", _("Finnish")),
|
||||
("en", _("English")),
|
||||
)
|
||||
|
||||
LANGUAGE_CODE = "fi"
|
||||
|
||||
LOCALE_PATHS = (os.path.join(BASE_DIR, "locale"),)
|
||||
|
||||
TIME_ZONE = "Europe/Helsinki"
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
||||
STATICFILES_FINDERS = (
|
||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
||||
)
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "collected_static")
|
||||
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = "/media/"
|
||||
|
||||
LOGIN_URL = "/login/"
|
||||
LOGIN_REDIRECT_URL = "/admin"
|
||||
|
||||
SUIT_CONFIG = {
|
||||
# header
|
||||
"ADMIN_NAME": "SIK Admin",
|
||||
# 'HEADER_DATE_FORMAT': 'l, j. F Y',
|
||||
# 'HEADER_TIME_FORMAT': 'H:i',
|
||||
# forms
|
||||
# 'SHOW_REQUIRED_ASTERISK': True, # Default True
|
||||
# 'CONFIRM_UNSAVED_CHANGES': True, # Default True
|
||||
# menu
|
||||
# 'SEARCH_URL': '/admin/auth/user/',
|
||||
# 'MENU_ICONS': {
|
||||
# 'sites': 'icon-leaf',
|
||||
# 'auth': 'icon-lock',
|
||||
# },
|
||||
# 'MENU_OPEN_FIRST_CHILD': True, # Default True
|
||||
# 'MENU_EXCLUDE': ('auth.group',),
|
||||
# 'MENU': (
|
||||
# 'sites',
|
||||
# {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
|
||||
# {'label': 'Settings', 'icon':'icon-cog', 'models': ('auth.user', 'auth.group')},
|
||||
# {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
|
||||
# ),
|
||||
# misc
|
||||
# 'LIST_PER_PAGE': 15
|
||||
}
|
||||
|
||||
JWT_AUTH = {"JWT_EXPIRATION_DELTA": datetime.timedelta(days=7)}
|
||||
|
||||
Reference in New Issue
Block a user