""" Django settings for webproj project. Generated by 'django-admin startproject' using Django 2.0.6. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/ """ from django.utils.translation import ugettext_lazy as _ from . import fsconfig import os DEVELOPING = os.uname()[1] == 'forest' SITE_NAME = fsconfig.SITE_NAME BASE_DIR = fsconfig.BASE_DIR SECRET_KEY = fsconfig.SECRET_KEY DEBUG = fsconfig.DEBUG and DEVELOPING ALLOWED_HOSTS = [ *fsconfig.SITE_DOMAIN, 'localhost', '127.0.0.1', ] if DEBUG and DEVELOPING: ALLOWED_HOSTS = '*' if not DEBUG: SECURE_BROWSER_XSS_FILTER = True SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_HSTS_PRELOAD = True SECURE_HSTS_SECONDS = 31536000 CORS_ORIGIN_WHITELIST = fsconfig.SITE_DOMAIN CSRF_TRUSTED_ORIGINS = fsconfig.SITE_DOMAIN # SECURE_SSL_REDIRECT = True and not DEBUG SECURE_CONTENT_TYPE_NOSNIFF = True CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True X_FRAME_OPTIONS = 'DENY' SASS_PRECISION = 13 SASS_OUTPUT_STYLE = 'compact' SASS_PROCESSOR_AUTO_INCLUDE = True SASS_PROCESSOR_ENABLED = True SASS_PROCESSOR_INCLUDE_DIRS = [ os.path.join(BASE_DIR, 'static'), ] # Application definition SITE_ID = 1 INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django_archive', 'ckeditor', 'colorfield', 'corsheaders', 'webproj.bff', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'webproj.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], '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', ], }, }, ] TEMPLATES[0]['DIRS'].append(os.path.join(BASE_DIR, 'webproj', 'templates')) WSGI_APPLICATION = 'webproj.wsgi.application' # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ LANGUAGES = [(iso, _(lang)) for iso, lang in fsconfig.LANGUAGES] 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/2.0/howto/static-files/ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'webproj', 'static_source'), ] MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') if DEBUG and DEVELOPING: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' DEFAULT_FROM_EMAIL = SITE_NAME+' ' RANGE_1_UNTIL_13 = range(1, 13) SETTINGS_EXPORT = [ 'SITE_NAME', 'RANGE_1_UNTIL_13', ] STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'sass_processor.finders.CssFinder', ] REST_FRAMEWORK = { 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer', ) } ROSETTA_WSGI_AUTO_RELOAD = True ACCOUNT_ACTIVATION_DAYS = 7 REGISTRATION_DEFAULT_FROM_EMAIL = SITE_NAME+' Registration ' REGISTRATION_EMAIL_HTML = True REGISTRATION_AUTO_LOGIN = True REGISTRATION_OPEN = fsconfig.REGISTRATION_OPEN CORS_URLS_REGEX = r'^/api/.*$' CORS_ORIGIN_REGEX_WHITELIST = [r'^.*$'] exec('from server_secrets.extraconfig import *')