Changeset View
Changeset View
Standalone View
Standalone View
studio/settings_common.py
| # noqa: D100 | # noqa: D100 | ||||
| from datetime import timedelta | from datetime import timedelta | ||||
| from dateutil.relativedelta import relativedelta | |||||
| import os # noqa: F401 | import os # noqa: F401 | ||||
| import pathlib | import pathlib | ||||
| import sys | import sys | ||||
| BASE_DIR = pathlib.Path(__file__).absolute().parent.parent | BASE_DIR = pathlib.Path(__file__).absolute().parent.parent | ||||
| ADMIN_SITE_HEADER = 'Blender Studio Admin' | ADMIN_SITE_HEADER = 'Blender Studio Admin' | ||||
| ADMIN_SITE_TITLE = 'Blender Studio' | ADMIN_SITE_TITLE = 'Blender Studio' | ||||
| # Application definition | # Application definition | ||||
| INSTALLED_APPS = [ | INSTALLED_APPS = [ | ||||
| 'django.contrib.flatpages', | 'django.contrib.flatpages', | ||||
| 'django_jsonfield_backport', | 'django_jsonfield_backport', | ||||
| 'emails', | 'emails', | ||||
| 'blog', | 'blog', | ||||
| 'comments', | 'comments', | ||||
| 'common', | 'common', | ||||
| 'films', | 'films', | ||||
| 'search', | 'search', | ||||
| 'static_assets', | 'static_assets', | ||||
| # 'subscriptions', | 'subscriptions', | ||||
| 'training', | 'training', | ||||
| 'cloud_import', | 'cloud_import', | ||||
| 'stats', | 'stats', | ||||
| 'django.contrib.admin', | 'django.contrib.admin', | ||||
| 'django.contrib.admindocs', | 'django.contrib.admindocs', | ||||
| 'django.contrib.auth', | 'django.contrib.auth', | ||||
| 'django.contrib.contenttypes', | 'django.contrib.contenttypes', | ||||
| 'django.contrib.humanize', | 'django.contrib.humanize', | ||||
| 'django.contrib.messages', | 'django.contrib.messages', | ||||
| 'django.contrib.sessions', | 'django.contrib.sessions', | ||||
| 'django.contrib.sites', | 'django.contrib.sites', | ||||
| 'django.contrib.staticfiles', | 'django.contrib.staticfiles', | ||||
| 'waffle', | 'waffle', | ||||
| 'blender_id_oauth_client', | 'blender_id_oauth_client', | ||||
| 'blendercloud', | 'blendercloud', | ||||
| 'profiles', | 'profiles', | ||||
| 'debug_toolbar', | 'debug_toolbar', | ||||
| # 'looper', | 'looper', | ||||
| 'pipeline', | 'pipeline', | ||||
| 'sorl.thumbnail', | 'sorl.thumbnail', | ||||
| 'taggit', | 'taggit', | ||||
| 'actstream', | 'actstream', | ||||
| 'background_task', | 'background_task', | ||||
| 'users', | 'users', | ||||
| 'nested_admin', | 'nested_admin', | ||||
| ] | ] | ||||
| AUTH_USER_MODEL = 'users.User' | AUTH_USER_MODEL = 'users.User' | ||||
| MIDDLEWARE = [ | MIDDLEWARE = [ | ||||
| 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', | 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', | ||||
| 'debug_toolbar.middleware.DebugToolbarMiddleware', | 'debug_toolbar.middleware.DebugToolbarMiddleware', | ||||
| 'django.middleware.security.SecurityMiddleware', | 'django.middleware.security.SecurityMiddleware', | ||||
| 'django.contrib.sessions.middleware.SessionMiddleware', | 'django.contrib.sessions.middleware.SessionMiddleware', | ||||
| 'django.middleware.common.CommonMiddleware', | 'django.middleware.common.CommonMiddleware', | ||||
| 'django.middleware.csrf.CsrfViewMiddleware', | 'django.middleware.csrf.CsrfViewMiddleware', | ||||
| 'django.contrib.auth.middleware.AuthenticationMiddleware', | 'django.contrib.auth.middleware.AuthenticationMiddleware', | ||||
| 'django.contrib.messages.middleware.MessageMiddleware', | 'django.contrib.messages.middleware.MessageMiddleware', | ||||
| 'django.middleware.clickjacking.XFrameOptionsMiddleware', | 'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||||
| 'blendercloud.middleware.SessionMiddleware', | 'blendercloud.middleware.SessionMiddleware', | ||||
| 'looper.middleware.PreferredCurrencyMiddleware', | |||||
| 'waffle.middleware.WaffleMiddleware', | 'waffle.middleware.WaffleMiddleware', | ||||
| ] | ] | ||||
| ROOT_URLCONF = 'studio.urls' | ROOT_URLCONF = 'studio.urls' | ||||
| STATIC_URL = '/static/' | STATIC_URL = '/static/' | ||||
| MEDIA_URL = '/media/' | MEDIA_URL = '/media/' | ||||
| STATIC_ROOT = BASE_DIR / 'public/static' | STATIC_ROOT = BASE_DIR / 'public/static' | ||||
| Show All 18 Lines | TEMPLATES = [ | ||||
| 'django.contrib.messages.context_processors.messages', | 'django.contrib.messages.context_processors.messages', | ||||
| 'common.context_processors.search_client_config', | 'common.context_processors.search_client_config', | ||||
| 'common.context_processors.settings_analytics_id', | 'common.context_processors.settings_analytics_id', | ||||
| 'common.context_processors.extra_context', | 'common.context_processors.extra_context', | ||||
| 'training.context_processors.enums', | 'training.context_processors.enums', | ||||
| # TODO(anna) when Profile model is added, this should become a prop on it instead. | # TODO(anna) when Profile model is added, this should become a prop on it instead. | ||||
| 'training.context_processors.favorited', | 'training.context_processors.favorited', | ||||
| 'users.context_processors.user_dict', | 'users.context_processors.user_dict', | ||||
| 'looper.context_processors.preferred_currency', | |||||
| ] | ] | ||||
| }, | }, | ||||
| }, | }, | ||||
| ] | ] | ||||
| WSGI_APPLICATION = 'studio.wsgi.application' | WSGI_APPLICATION = 'studio.wsgi.application' | ||||
| # Password validation | # Password validation | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | 'JAVASCRIPT': { | ||||
| 'output_filename': 'js/vendor_instantsearch.js', | 'output_filename': 'js/vendor_instantsearch.js', | ||||
| 'extra_context': {'async': False, 'defer': False}, | 'extra_context': {'async': False, 'defer': False}, | ||||
| }, | }, | ||||
| 'vendor_chartjs': { | 'vendor_chartjs': { | ||||
| 'source_filenames': ['common/scripts/vendor/chart.bundle.min.js'], | 'source_filenames': ['common/scripts/vendor/chart.bundle.min.js'], | ||||
| 'output_filename': 'js/vendor_chartjs.js', | 'output_filename': 'js/vendor_chartjs.js', | ||||
| 'extra_context': {'async': False, 'defer': False}, | 'extra_context': {'async': False, 'defer': False}, | ||||
| }, | }, | ||||
| 'looper': { | |||||
| 'source_filenames': [ | |||||
| 'looper/scripts/*.js', | |||||
| ], | |||||
| 'output_filename': 'js/looper.js', | |||||
| 'extra_context': {'async': False, 'defer': False}, | |||||
| }, | |||||
| 'subscriptions': { | |||||
| 'source_filenames': [ | |||||
| 'common/scripts/ajax.js', | |||||
| 'subscriptions/scripts/*.js', | |||||
| ], | |||||
| 'output_filename': 'js/subscriptions.js', | |||||
| 'extra_context': {'async': False, 'defer': False}, | |||||
| }, | |||||
| }, | }, | ||||
| 'STYLESHEETS': { | 'STYLESHEETS': { | ||||
| 'studio': { | 'studio': { | ||||
| 'source_filenames': ('common/styles/studio/studio.scss',), | 'source_filenames': ('common/styles/studio/studio.scss',), | ||||
| 'output_filename': 'css/studio.css', | 'output_filename': 'css/studio.css', | ||||
| 'extra_context': {'media': 'screen'}, | 'extra_context': {'media': 'screen'}, | ||||
| }, | }, | ||||
| }, | }, | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | 'RANKING_RULES': { | ||||
| f'{TRAINING_INDEX_UID}_date_asc': DATE_ASC_RANKING_RULES, | f'{TRAINING_INDEX_UID}_date_asc': DATE_ASC_RANKING_RULES, | ||||
| }, | }, | ||||
| } | } | ||||
| TAGGIT_CASE_INSENSITIVE = True | TAGGIT_CASE_INSENSITIVE = True | ||||
| GOOGLE_ANALYTICS_TRACKING_ID = '' | GOOGLE_ANALYTICS_TRACKING_ID = '' | ||||
| GOOGLE_RECAPTCHA_SITE_KEY = '' | |||||
| GOOGLE_RECAPTCHA_SECRET_KEY = '' | |||||
| DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' | DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' | ||||
| PUBLIC_FILE_STORAGE = 'common.storage.S3PublicStorage' | PUBLIC_FILE_STORAGE = 'common.storage.S3PublicStorage' | ||||
| # Do not set "public-read" ACL on bucket items | # Do not set "public-read" ACL on bucket items | ||||
| AWS_DEFAULT_ACL = None | AWS_DEFAULT_ACL = None | ||||
| AWS_S3_FILE_OVERWRITE = False | AWS_S3_FILE_OVERWRITE = False | ||||
| AWS_S3_REGION_NAME = 'eu-central-1' | AWS_S3_REGION_NAME = 'eu-central-1' | ||||
| AWS_STORAGE_BUCKET_NAME = 'blender-studio' | AWS_STORAGE_BUCKET_NAME = 'blender-studio' | ||||
| Show All 33 Lines | |||||
| NEWSLETTER_NONSUBSCRIBER_LIST = None | NEWSLETTER_NONSUBSCRIBER_LIST = None | ||||
| NEWSLETTER_SUBSCRIBER_LIST = None | NEWSLETTER_SUBSCRIBER_LIST = None | ||||
| MAILGUN_SENDER_DOMAIN = 'sandboxf44696c342d9425abae785deb255717e.mailgun.org' | MAILGUN_SENDER_DOMAIN = 'sandboxf44696c342d9425abae785deb255717e.mailgun.org' | ||||
| ADMIN_MAIL = 'cloudsupport@blender.org' | ADMIN_MAIL = 'cloudsupport@blender.org' | ||||
| STORE_PRODUCT_URL = 'https://store.blender.org/product/membership/' | STORE_PRODUCT_URL = 'https://store.blender.org/product/membership/' | ||||
| STORE_MANAGE_URL = 'https://store.blender.org/my-account/subscriptions/' | STORE_MANAGE_URL = 'https://store.blender.org/my-account/subscriptions/' | ||||
| # Collection of automatically renewing subscriptions will be attempted this | |||||
| # many times before giving up and setting the subscription status to 'on-hold'. | |||||
| # | |||||
| # This value is only used when automatic renewal fails, so setting it < 1 will | |||||
| # be treated the same as 1 (one attempt is made, and failure is immediate, no | |||||
| # retries). | |||||
| LOOPER_CLOCK_MAX_AUTO_ATTEMPTS = 3 | |||||
| # Only retry collection of automatic renewals this long after the last failure. | |||||
| # This separates the frequency of retrials from the frequency of the clock. | |||||
| LOOPER_ORDER_RETRY_AFTER = relativedelta(days=2) | |||||
| # This user is required for logging things in the admin history | |||||
| # (those log entries always need to have a non-NULL user ID). | |||||
| LOOPER_SYSTEM_USER_ID = 1 | |||||
| # Convertion rates from the given rate to euros. | |||||
| # This allows us to express the foreign currency in €. | |||||
| LOOPER_CONVERTION_RATES_FROM_EURO = { | |||||
| 'EUR': 1.0, | |||||
| 'USD': 1.15, | |||||
| } | |||||
| LOOPER_SUBSCRIPTION_CREATION_WARNING_THRESHOLD = relativedelta(days=1) | |||||
| LOOPER_ORDER_RECEIPT_PDF_URL = 'subscriptions:receipt-pdf' | |||||
| # By default, dump emails to the console instead of trying to actually send them. | |||||
| EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | |||||
| TESTS_IN_PROGRESS = 'test' in sys.argv | TESTS_IN_PROGRESS = 'test' in sys.argv | ||||
| if TESTS_IN_PROGRESS: | if TESTS_IN_PROGRESS: | ||||
| STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' | STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' | ||||
| AWS_STORAGE_BUCKET_NAME = 'blender-studio-test' | AWS_STORAGE_BUCKET_NAME = 'blender-studio-test' | ||||