We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add Staging, PreProduction & Production settings
## Purpose

At the time of writing, available configurations for Marsha are: `Development` and `Test`. We need more settings for missing environments. 

## Proposal

- [ ] Add `Production` configuration
- [ ] Derive `Staging` and `Preproduction` configurations from `Production`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `marsha/settings.py`
Content:
```
1 """Django settings for marsha project.
2 
3 Uses django-configurations to manage environments inheritance and the loading of some
4 config from the environment
5 
6 """
7 
8 from datetime import timedelta
9 import os
10 
11 from django.utils.translation import gettext_lazy as _
12 
13 from configurations import Configuration, values
14 import sentry_sdk
15 from sentry_sdk.integrations.django import DjangoIntegration
16 
17 
18 class Base(Configuration):
19     """Base configuration every configuration (aka environment) should inherit from.
20 
21     It depends on an environment variable that SHOULD be defined:
22     - DJANGO_SECRET_KEY
23 
24     You may also want to override default configuration by setting the following
25     environment variables:
26     - DJANGO_DEBUG
27     - DATABASE_URL
28     """
29 
30     BASE_DIR = os.path.dirname(__file__)
31     DATA_DIR = values.Value(os.path.join("/", "data"))
32 
33     # Static files (CSS, JavaScript, Images)
34     STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
35     STATIC_URL = "/static/"
36     MEDIA_URL = "/media/"
37     # Allow to configure location of static/media files for non-Docker installation
38     MEDIA_ROOT = values.Value(os.path.join(str(DATA_DIR), "media"))
39     STATIC_ROOT = values.Value(os.path.join(str(DATA_DIR), "static"))
40 
41     SECRET_KEY = values.SecretValue()
42 
43     DEBUG = values.BooleanValue(False)
44 
45     DATABASES = {
46         "default": {
47             "ENGINE": values.Value(
48                 "django.db.backends.postgresql_psycopg2",
49                 environ_name="DATABASE_ENGINE",
50                 environ_prefix=None,
51             ),
52             "NAME": values.Value(
53                 "marsha", environ_name="POSTGRES_DB", environ_prefix=None
54             ),
55             "USER": values.Value(
56                 "marsha_user", environ_name="POSTGRES_USER", environ_prefix=None
57             ),
58             "PASSWORD": values.Value(
59                 "pass", environ_name="POSTGRES_PASSWORD", environ_prefix=None
60             ),
61             "HOST": values.Value(
62                 "localhost", environ_name="POSTGRES_HOST", environ_prefix=None
63             ),
64             "PORT": values.Value(
65                 5432, environ_name="POSTGRES_PORT", environ_prefix=None
66             ),
67         }
68     }
69 
70     ALLOWED_HOSTS = []
71 
72     # Application definition
73 
74     INSTALLED_APPS = [
75         "django.contrib.admin.apps.SimpleAdminConfig",
76         "django.contrib.auth",
77         "django.contrib.contenttypes",
78         "django.contrib.sessions",
79         "django.contrib.messages",
80         "django.contrib.staticfiles",
81         "django_extensions",
82         "rest_framework",
83         "marsha.core.apps.CoreConfig",
84     ]
85 
86     MIDDLEWARE = [
87         "django.middleware.security.SecurityMiddleware",
88         "django.contrib.sessions.middleware.SessionMiddleware",
89         "django.middleware.common.CommonMiddleware",
90         "django.middleware.csrf.CsrfViewMiddleware",
91         "django.contrib.auth.middleware.AuthenticationMiddleware",
92         "django.contrib.messages.middleware.MessageMiddleware",
93         "django.middleware.clickjacking.XFrameOptionsMiddleware",
94     ]
95 
96     ROOT_URLCONF = "marsha.urls"
97 
98     TEMPLATES = [
99         {
100             "BACKEND": "django.template.backends.django.DjangoTemplates",
101             "DIRS": [],
102             "APP_DIRS": True,
103             "OPTIONS": {
104                 "context_processors": [
105                     "django.template.context_processors.debug",
106                     "django.template.context_processors.request",
107                     "django.contrib.auth.context_processors.auth",
108                     "django.contrib.messages.context_processors.messages",
109                 ]
110             },
111         }
112     ]
113 
114     AUTH_USER_MODEL = "core.User"
115 
116     WSGI_APPLICATION = "marsha.wsgi.application"
117 
118     REST_FRAMEWORK = {
119         "DEFAULT_AUTHENTICATION_CLASSES": (
120             "rest_framework_simplejwt.authentication.JWTTokenUserAuthentication",
121         )
122     }
123 
124     # Password validation
125     # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
126     AUTH_PASSWORD_VALIDATORS = [
127         {
128             "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
129         },
130         {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
131         {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
132         {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
133     ]
134 
135     JWT_SIGNING_KEY = values.SecretValue()
136 
137     # Internationalization
138     # https://docs.djangoproject.com/en/2.0/topics/i18n/
139 
140     LANGUAGE_CODE = "en-us"
141 
142     LANGUAGES = [("en", _("english")), ("fr", _("french"))]
143 
144     # Internationalization
145     TIME_ZONE = "UTC"
146     USE_I18N = True
147     USE_L10N = True
148     USE_TZ = True
149 
150     VIDEO_RESOLUTIONS = [144, 240, 480, 720, 1080]
151 
152     # AWS
153     AWS_ACCESS_KEY_ID = values.SecretValue()
154     AWS_SECRET_ACCESS_KEY = values.SecretValue()
155     AWS_DEFAULT_REGION = values.Value("eu-west-1")
156     UPDATE_STATE_SHARED_SECRETS = values.ListValue()
157 
158     # Cloud Front key pair for signed urls
159     CLOUDFRONT_URL = values.SecretValue()
160     CLOUDFRONT_ACCESS_KEY_ID = values.Value(None)
161     CLOUDFRONT_PRIVATE_KEY_PATH = values.Value(
162         os.path.join(BASE_DIR, "..", ".ssh", "cloudfront_private_key")
163     )
164     CLOUDFRONT_SIGNED_URLS_ACTIVE = True
165     CLOUDFRONT_SIGNED_URLS_VALIDITY = 2 * 60 * 60  # 2 hours
166 
167     # pylint: disable=invalid-name
168     @property
169     def SIMPLE_JWT(self):
170         """Define settings for `djangorestframework_simplejwt`.
171 
172         The JWT_SIGNING_KEY must be evaluated late as the jwt library check for string type.
173         """
174         return {
175             "ACCESS_TOKEN_LIFETIME": timedelta(days=1),
176             "ALGORITHM": "HS256",
177             "SIGNING_KEY": str(self.JWT_SIGNING_KEY),
178             "USER_ID_CLAIM": "video_id",
179             "AUTH_TOKEN_CLASSES": ("rest_framework_simplejwt.tokens.AccessToken",),
180         }
181 
182     @classmethod
183     def post_setup(cls):
184         """Post setup configuration.
185 
186         This is the place where you can configure settings that require other
187         settings to be loaded.
188         """
189         super().post_setup()
190 
191         # The DJANGO_SENTRY_DSN environment variable should be set to activate
192         # sentry for an environment
193         sentry_dsn = values.Value(None, environ_name="SENTRY_DSN")
194         if sentry_dsn is not None:
195             sentry_sdk.init(
196                 dsn=sentry_dsn,
197                 environment=cls.__name__.lower(),
198                 integrations=[DjangoIntegration()],
199             )
200 
201 
202 class Development(Base):
203     """Development environment settings.
204 
205     We set ``DEBUG`` to ``True`` by default, configure the server to respond to all hosts,
206     and use a local sqlite database by default.
207     """
208 
209     DEBUG = values.BooleanValue(True)
210     ALLOWED_HOSTS = ["*"]
211 
212     AWS_SOURCE_BUCKET_NAME = "development-marsha-source"
213 
214 
215 class Test(Base):
216     """Test environment settings."""
217 
218     AWS_SOURCE_BUCKET_NAME = "test-marsha-source"
219 
220     CLOUDFRONT_SIGNED_URLS_ACTIVE = False
221
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/marsha/settings.py b/marsha/settings.py
--- a/marsha/settings.py
+++ b/marsha/settings.py
@@ -218,3 +218,27 @@
     AWS_SOURCE_BUCKET_NAME = "test-marsha-source"
 
     CLOUDFRONT_SIGNED_URLS_ACTIVE = False
+
+
+class Production(Base):
+    """Production environment settings.
+
+    You must define the DJANGO_ALLOWED_HOSTS environment variable in Production
+    configuration (and derived configurations):
+
+    DJANGO_ALLOWED_HOSTS="foo.com,foo.fr"
+    """
+
+    ALLOWED_HOSTS = values.ListValue(None)
+
+
+class Staging(Production):
+    """Staging environment settings."""
+
+    pass
+
+
+class PreProduction(Production):
+    """Pre-production environment settings."""
+
+    pass

{"golden_diff": "diff --git a/marsha/settings.py b/marsha/settings.py\n--- a/marsha/settings.py\n+++ b/marsha/settings.py\n@@ -218,3 +218,27 @@\n     AWS_SOURCE_BUCKET_NAME = \"test-marsha-source\"\n \n     CLOUDFRONT_SIGNED_URLS_ACTIVE = False\n+\n+\n+class Production(Base):\n+    \"\"\"Production environment settings.\n+\n+    You must define the DJANGO_ALLOWED_HOSTS environment variable in Production\n+    configuration (and derived configurations):\n+\n+    DJANGO_ALLOWED_HOSTS=\"foo.com,foo.fr\"\n+    \"\"\"\n+\n+    ALLOWED_HOSTS = values.ListValue(None)\n+\n+\n+class Staging(Production):\n+    \"\"\"Staging environment settings.\"\"\"\n+\n+    pass\n+\n+\n+class PreProduction(Production):\n+    \"\"\"Pre-production environment settings.\"\"\"\n+\n+    pass\n", "issue": "Add Staging, PreProduction & Production settings\n## Purpose\r\n\r\nAt the time of writing, available configurations for Marsha are: `Development` and `Test`. We need more settings for missing environments. \r\n\r\n## Proposal\r\n\r\n- [ ] Add `Production` configuration\r\n- [ ] Derive `Staging` and `Preproduction` configurations from `Production`\n", "before_files": [{"content": "\"\"\"Django settings for marsha project.\n\nUses django-configurations to manage environments inheritance and the loading of some\nconfig from the environment\n\n\"\"\"\n\nfrom datetime import timedelta\nimport os\n\nfrom django.utils.translation import gettext_lazy as _\n\nfrom configurations import Configuration, values\nimport sentry_sdk\nfrom sentry_sdk.integrations.django import DjangoIntegration\n\n\nclass Base(Configuration):\n    \"\"\"Base configuration every configuration (aka environment) should inherit from.\n\n    It depends on an environment variable that SHOULD be defined:\n    - DJANGO_SECRET_KEY\n\n    You may also want to override default configuration by setting the following\n    environment variables:\n    - DJANGO_DEBUG\n    - DATABASE_URL\n    \"\"\"\n\n    BASE_DIR = os.path.dirname(__file__)\n    DATA_DIR = values.Value(os.path.join(\"/\", \"data\"))\n\n    # Static files (CSS, JavaScript, Images)\n    STATICFILES_DIRS = (os.path.join(BASE_DIR, \"static\"),)\n    STATIC_URL = \"/static/\"\n    MEDIA_URL = \"/media/\"\n    # Allow to configure location of static/media files for non-Docker installation\n    MEDIA_ROOT = values.Value(os.path.join(str(DATA_DIR), \"media\"))\n    STATIC_ROOT = values.Value(os.path.join(str(DATA_DIR), \"static\"))\n\n    SECRET_KEY = values.SecretValue()\n\n    DEBUG = values.BooleanValue(False)\n\n    DATABASES = {\n        \"default\": {\n            \"ENGINE\": values.Value(\n                \"django.db.backends.postgresql_psycopg2\",\n                environ_name=\"DATABASE_ENGINE\",\n                environ_prefix=None,\n            ),\n            \"NAME\": values.Value(\n                \"marsha\", environ_name=\"POSTGRES_DB\", environ_prefix=None\n            ),\n            \"USER\": values.Value(\n                \"marsha_user\", environ_name=\"POSTGRES_USER\", environ_prefix=None\n            ),\n            \"PASSWORD\": values.Value(\n                \"pass\", environ_name=\"POSTGRES_PASSWORD\", environ_prefix=None\n            ),\n            \"HOST\": values.Value(\n                \"localhost\", environ_name=\"POSTGRES_HOST\", environ_prefix=None\n            ),\n            \"PORT\": values.Value(\n                5432, environ_name=\"POSTGRES_PORT\", environ_prefix=None\n            ),\n        }\n    }\n\n    ALLOWED_HOSTS = []\n\n    # Application definition\n\n    INSTALLED_APPS = [\n        \"django.contrib.admin.apps.SimpleAdminConfig\",\n        \"django.contrib.auth\",\n        \"django.contrib.contenttypes\",\n        \"django.contrib.sessions\",\n        \"django.contrib.messages\",\n        \"django.contrib.staticfiles\",\n        \"django_extensions\",\n        \"rest_framework\",\n        \"marsha.core.apps.CoreConfig\",\n    ]\n\n    MIDDLEWARE = [\n        \"django.middleware.security.SecurityMiddleware\",\n        \"django.contrib.sessions.middleware.SessionMiddleware\",\n        \"django.middleware.common.CommonMiddleware\",\n        \"django.middleware.csrf.CsrfViewMiddleware\",\n        \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n        \"django.contrib.messages.middleware.MessageMiddleware\",\n        \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n    ]\n\n    ROOT_URLCONF = \"marsha.urls\"\n\n    TEMPLATES = [\n        {\n            \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n            \"DIRS\": [],\n            \"APP_DIRS\": True,\n            \"OPTIONS\": {\n                \"context_processors\": [\n                    \"django.template.context_processors.debug\",\n                    \"django.template.context_processors.request\",\n                    \"django.contrib.auth.context_processors.auth\",\n                    \"django.contrib.messages.context_processors.messages\",\n                ]\n            },\n        }\n    ]\n\n    AUTH_USER_MODEL = \"core.User\"\n\n    WSGI_APPLICATION = \"marsha.wsgi.application\"\n\n    REST_FRAMEWORK = {\n        \"DEFAULT_AUTHENTICATION_CLASSES\": (\n            \"rest_framework_simplejwt.authentication.JWTTokenUserAuthentication\",\n        )\n    }\n\n    # Password validation\n    # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators\n    AUTH_PASSWORD_VALIDATORS = [\n        {\n            \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\"\n        },\n        {\"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\"},\n        {\"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\"},\n        {\"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\"},\n    ]\n\n    JWT_SIGNING_KEY = values.SecretValue()\n\n    # Internationalization\n    # https://docs.djangoproject.com/en/2.0/topics/i18n/\n\n    LANGUAGE_CODE = \"en-us\"\n\n    LANGUAGES = [(\"en\", _(\"english\")), (\"fr\", _(\"french\"))]\n\n    # Internationalization\n    TIME_ZONE = \"UTC\"\n    USE_I18N = True\n    USE_L10N = True\n    USE_TZ = True\n\n    VIDEO_RESOLUTIONS = [144, 240, 480, 720, 1080]\n\n    # AWS\n    AWS_ACCESS_KEY_ID = values.SecretValue()\n    AWS_SECRET_ACCESS_KEY = values.SecretValue()\n    AWS_DEFAULT_REGION = values.Value(\"eu-west-1\")\n    UPDATE_STATE_SHARED_SECRETS = values.ListValue()\n\n    # Cloud Front key pair for signed urls\n    CLOUDFRONT_URL = values.SecretValue()\n    CLOUDFRONT_ACCESS_KEY_ID = values.Value(None)\n    CLOUDFRONT_PRIVATE_KEY_PATH = values.Value(\n        os.path.join(BASE_DIR, \"..\", \".ssh\", \"cloudfront_private_key\")\n    )\n    CLOUDFRONT_SIGNED_URLS_ACTIVE = True\n    CLOUDFRONT_SIGNED_URLS_VALIDITY = 2 * 60 * 60  # 2 hours\n\n    # pylint: disable=invalid-name\n    @property\n    def SIMPLE_JWT(self):\n        \"\"\"Define settings for `djangorestframework_simplejwt`.\n\n        The JWT_SIGNING_KEY must be evaluated late as the jwt library check for string type.\n        \"\"\"\n        return {\n            \"ACCESS_TOKEN_LIFETIME\": timedelta(days=1),\n            \"ALGORITHM\": \"HS256\",\n            \"SIGNING_KEY\": str(self.JWT_SIGNING_KEY),\n            \"USER_ID_CLAIM\": \"video_id\",\n            \"AUTH_TOKEN_CLASSES\": (\"rest_framework_simplejwt.tokens.AccessToken\",),\n        }\n\n    @classmethod\n    def post_setup(cls):\n        \"\"\"Post setup configuration.\n\n        This is the place where you can configure settings that require other\n        settings to be loaded.\n        \"\"\"\n        super().post_setup()\n\n        # The DJANGO_SENTRY_DSN environment variable should be set to activate\n        # sentry for an environment\n        sentry_dsn = values.Value(None, environ_name=\"SENTRY_DSN\")\n        if sentry_dsn is not None:\n            sentry_sdk.init(\n                dsn=sentry_dsn,\n                environment=cls.__name__.lower(),\n                integrations=[DjangoIntegration()],\n            )\n\n\nclass Development(Base):\n    \"\"\"Development environment settings.\n\n    We set ``DEBUG`` to ``True`` by default, configure the server to respond to all hosts,\n    and use a local sqlite database by default.\n    \"\"\"\n\n    DEBUG = values.BooleanValue(True)\n    ALLOWED_HOSTS = [\"*\"]\n\n    AWS_SOURCE_BUCKET_NAME = \"development-marsha-source\"\n\n\nclass Test(Base):\n    \"\"\"Test environment settings.\"\"\"\n\n    AWS_SOURCE_BUCKET_NAME = \"test-marsha-source\"\n\n    CLOUDFRONT_SIGNED_URLS_ACTIVE = False\n", "path": "marsha/settings.py"}], "after_files": [{"content": "\"\"\"Django settings for marsha project.\n\nUses django-configurations to manage environments inheritance and the loading of some\nconfig from the environment\n\n\"\"\"\n\nfrom datetime import timedelta\nimport os\n\nfrom django.utils.translation import gettext_lazy as _\n\nfrom configurations import Configuration, values\nimport sentry_sdk\nfrom sentry_sdk.integrations.django import DjangoIntegration\n\n\nclass Base(Configuration):\n    \"\"\"Base configuration every configuration (aka environment) should inherit from.\n\n    It depends on an environment variable that SHOULD be defined:\n    - DJANGO_SECRET_KEY\n\n    You may also want to override default configuration by setting the following\n    environment variables:\n    - DJANGO_DEBUG\n    - DATABASE_URL\n    \"\"\"\n\n    BASE_DIR = os.path.dirname(__file__)\n    DATA_DIR = values.Value(os.path.join(\"/\", \"data\"))\n\n    # Static files (CSS, JavaScript, Images)\n    STATICFILES_DIRS = (os.path.join(BASE_DIR, \"static\"),)\n    STATIC_URL = \"/static/\"\n    MEDIA_URL = \"/media/\"\n    # Allow to configure location of static/media files for non-Docker installation\n    MEDIA_ROOT = values.Value(os.path.join(str(DATA_DIR), \"media\"))\n    STATIC_ROOT = values.Value(os.path.join(str(DATA_DIR), \"static\"))\n\n    SECRET_KEY = values.SecretValue()\n\n    DEBUG = values.BooleanValue(False)\n\n    DATABASES = {\n        \"default\": {\n            \"ENGINE\": values.Value(\n                \"django.db.backends.postgresql_psycopg2\",\n                environ_name=\"DATABASE_ENGINE\",\n                environ_prefix=None,\n            ),\n            \"NAME\": values.Value(\n                \"marsha\", environ_name=\"POSTGRES_DB\", environ_prefix=None\n            ),\n            \"USER\": values.Value(\n                \"marsha_user\", environ_name=\"POSTGRES_USER\", environ_prefix=None\n            ),\n            \"PASSWORD\": values.Value(\n                \"pass\", environ_name=\"POSTGRES_PASSWORD\", environ_prefix=None\n            ),\n            \"HOST\": values.Value(\n                \"localhost\", environ_name=\"POSTGRES_HOST\", environ_prefix=None\n            ),\n            \"PORT\": values.Value(\n                5432, environ_name=\"POSTGRES_PORT\", environ_prefix=None\n            ),\n        }\n    }\n\n    ALLOWED_HOSTS = []\n\n    # Application definition\n\n    INSTALLED_APPS = [\n        \"django.contrib.admin.apps.SimpleAdminConfig\",\n        \"django.contrib.auth\",\n        \"django.contrib.contenttypes\",\n        \"django.contrib.sessions\",\n        \"django.contrib.messages\",\n        \"django.contrib.staticfiles\",\n        \"django_extensions\",\n        \"rest_framework\",\n        \"marsha.core.apps.CoreConfig\",\n    ]\n\n    MIDDLEWARE = [\n        \"django.middleware.security.SecurityMiddleware\",\n        \"django.contrib.sessions.middleware.SessionMiddleware\",\n        \"django.middleware.common.CommonMiddleware\",\n        \"django.middleware.csrf.CsrfViewMiddleware\",\n        \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n        \"django.contrib.messages.middleware.MessageMiddleware\",\n        \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n    ]\n\n    ROOT_URLCONF = \"marsha.urls\"\n\n    TEMPLATES = [\n        {\n            \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n            \"DIRS\": [],\n            \"APP_DIRS\": True,\n            \"OPTIONS\": {\n                \"context_processors\": [\n                    \"django.template.context_processors.debug\",\n                    \"django.template.context_processors.request\",\n                    \"django.contrib.auth.context_processors.auth\",\n                    \"django.contrib.messages.context_processors.messages\",\n                ]\n            },\n        }\n    ]\n\n    AUTH_USER_MODEL = \"core.User\"\n\n    WSGI_APPLICATION = \"marsha.wsgi.application\"\n\n    REST_FRAMEWORK = {\n        \"DEFAULT_AUTHENTICATION_CLASSES\": (\n            \"rest_framework_simplejwt.authentication.JWTTokenUserAuthentication\",\n        )\n    }\n\n    # Password validation\n    # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators\n    AUTH_PASSWORD_VALIDATORS = [\n        {\n            \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\"\n        },\n        {\"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\"},\n        {\"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\"},\n        {\"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\"},\n    ]\n\n    JWT_SIGNING_KEY = values.SecretValue()\n\n    # Internationalization\n    # https://docs.djangoproject.com/en/2.0/topics/i18n/\n\n    LANGUAGE_CODE = \"en-us\"\n\n    LANGUAGES = [(\"en\", _(\"english\")), (\"fr\", _(\"french\"))]\n\n    # Internationalization\n    TIME_ZONE = \"UTC\"\n    USE_I18N = True\n    USE_L10N = True\n    USE_TZ = True\n\n    VIDEO_RESOLUTIONS = [144, 240, 480, 720, 1080]\n\n    # AWS\n    AWS_ACCESS_KEY_ID = values.SecretValue()\n    AWS_SECRET_ACCESS_KEY = values.SecretValue()\n    AWS_DEFAULT_REGION = values.Value(\"eu-west-1\")\n    UPDATE_STATE_SHARED_SECRETS = values.ListValue()\n\n    # Cloud Front key pair for signed urls\n    CLOUDFRONT_URL = values.SecretValue()\n    CLOUDFRONT_ACCESS_KEY_ID = values.Value(None)\n    CLOUDFRONT_PRIVATE_KEY_PATH = values.Value(\n        os.path.join(BASE_DIR, \"..\", \".ssh\", \"cloudfront_private_key\")\n    )\n    CLOUDFRONT_SIGNED_URLS_ACTIVE = True\n    CLOUDFRONT_SIGNED_URLS_VALIDITY = 2 * 60 * 60  # 2 hours\n\n    # pylint: disable=invalid-name\n    @property\n    def SIMPLE_JWT(self):\n        \"\"\"Define settings for `djangorestframework_simplejwt`.\n\n        The JWT_SIGNING_KEY must be evaluated late as the jwt library check for string type.\n        \"\"\"\n        return {\n            \"ACCESS_TOKEN_LIFETIME\": timedelta(days=1),\n            \"ALGORITHM\": \"HS256\",\n            \"SIGNING_KEY\": str(self.JWT_SIGNING_KEY),\n            \"USER_ID_CLAIM\": \"video_id\",\n            \"AUTH_TOKEN_CLASSES\": (\"rest_framework_simplejwt.tokens.AccessToken\",),\n        }\n\n    @classmethod\n    def post_setup(cls):\n        \"\"\"Post setup configuration.\n\n        This is the place where you can configure settings that require other\n        settings to be loaded.\n        \"\"\"\n        super().post_setup()\n\n        # The DJANGO_SENTRY_DSN environment variable should be set to activate\n        # sentry for an environment\n        sentry_dsn = values.Value(None, environ_name=\"SENTRY_DSN\")\n        if sentry_dsn is not None:\n            sentry_sdk.init(\n                dsn=sentry_dsn,\n                environment=cls.__name__.lower(),\n                integrations=[DjangoIntegration()],\n            )\n\n\nclass Development(Base):\n    \"\"\"Development environment settings.\n\n    We set ``DEBUG`` to ``True`` by default, configure the server to respond to all hosts,\n    and use a local sqlite database by default.\n    \"\"\"\n\n    DEBUG = values.BooleanValue(True)\n    ALLOWED_HOSTS = [\"*\"]\n\n    AWS_SOURCE_BUCKET_NAME = \"development-marsha-source\"\n\n\nclass Test(Base):\n    \"\"\"Test environment settings.\"\"\"\n\n    AWS_SOURCE_BUCKET_NAME = \"test-marsha-source\"\n\n    CLOUDFRONT_SIGNED_URLS_ACTIVE = False\n\n\nclass Production(Base):\n    \"\"\"Production environment settings.\n\n    You must define the DJANGO_ALLOWED_HOSTS environment variable in Production\n    configuration (and derived configurations):\n\n    DJANGO_ALLOWED_HOSTS=\"foo.com,foo.fr\"\n    \"\"\"\n\n    ALLOWED_HOSTS = values.ListValue(None)\n\n\nclass Staging(Production):\n    \"\"\"Staging environment settings.\"\"\"\n\n    pass\n\n\nclass PreProduction(Production):\n    \"\"\"Pre-production environment settings.\"\"\"\n\n    pass\n", "path": "marsha/settings.py"}]}