We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
La connexion avec Google ne fonctionne pas sur le serveur de bêta
Problème rapporté par Sentry.

La connexion avec Google ne fonctionne pas sur le serveur de bêta, on a une erreur 500 à cause d'une erreur dans le paquet social-auth-core. Même en testant avec la dernière version de ce paquet le problème n'est pas corrigé.

J'ai ouvert un ticket chez social-auth-core : https://github.com/python-social-auth/social-core/issues/847


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `zds/settings/prod.py`
Content:
```
1 from sentry_sdk.integrations.django import DjangoIntegration
2 from sentry_sdk.integrations.logging import ignore_logger
3 import sentry_sdk
4 
5 from .abstract_base import *
6 
7 # For secrets, prefer `config[key]` over `config.get(key)` in this
8 # file because we really want to raise an error if a secret is not
9 # defined.
10 
11 
12 ###############################################################################
13 # DJANGO SETTINGS
14 
15 
16 DEBUG = False
17 
18 USE_L10N = True
19 
20 DATABASES = {
21     "default": {
22         "ENGINE": "django.db.backends.mysql",
23         "NAME": config["databases"]["default"].get("name", "zdsdb"),
24         "USER": config["databases"]["default"].get("user", "zds"),
25         "PASSWORD": config["databases"]["default"]["password"],
26         "HOST": "localhost",
27         "PORT": "",
28         "CONN_MAX_AGE": 600,
29         "OPTIONS": {
30             "charset": "utf8mb4",
31         },
32     },
33 }
34 
35 ALLOWED_HOSTS = [
36     "beta.zestedesavoir.com",
37     "scaleway.zestedesavoir.com",
38     "zdsappserver",
39     "gandi.zestedesavoir.com",
40     "gandi.zestedesavoir.com.",
41     ".zestedesavoir.com",
42     ".zestedesavoir.com.",
43     "127.0.0.1",
44     "localhost",
45     "163.172.171.246",
46 ]
47 
48 EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
49 EMAIL_USE_TLS = False
50 EMAIL_HOST = "localhost"
51 EMAIL_PORT = 25
52 
53 CACHES = {
54     "default": {
55         "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
56         "LOCATION": "127.0.0.1:11211",
57     }
58 }
59 
60 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
61 SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 4
62 
63 MEDIA_ROOT = Path("/opt/zds/data/media")
64 
65 STATIC_ROOT = Path("/opt/zds/data/static")
66 STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
67 
68 django_template_engine["APP_DIRS"] = False
69 django_template_engine["OPTIONS"]["loaders"] = [
70     (
71         "django.template.loaders.cached.Loader",
72         [
73             "django.template.loaders.filesystem.Loader",
74             "django.template.loaders.app_directories.Loader",
75         ],
76     ),
77 ]
78 
79 
80 def _get_version():
81     from zds import __version__, git_version
82 
83     if git_version is None:
84         return __version__
85     else:
86         return f"{__version__}/{git_version[:7]}"
87 
88 
89 sentry_sdk.init(
90     dsn=config["sentry"]["dsn"],
91     integrations=[DjangoIntegration()],
92     # Set traces_sample_rate to 1.0 to capture 100%
93     # of transactions for performance monitoring.
94     # We recommend adjusting this value in production,
95     traces_sample_rate=1.0,
96     # If you wish to associate users to errors (assuming you are using
97     # django.contrib.auth) you may enable sending PII data.
98     send_default_pii=True,
99     # By default the SDK will try to use the SENTRY_RELEASE
100     # environment variable, or infer a git commit
101     # SHA as release, however you may want to set
102     # something more human-readable.
103     release=_get_version().replace("/", "#"),
104     # /!\ It cannot contain slashes
105     environment=config["sentry"]["environment"],
106 )
107 
108 # Ignoring emarkdown logging because it is too noisy
109 ignore_logger("zds.utils.templatetags.emarkdown")
110 
111 
112 ###############################################################################
113 # REQUIREMENTS SETTINGS
114 
115 
116 # easy-thumbnails
117 # http://easy-thumbnails.readthedocs.io/en/2.1/ref/optimize/
118 THUMBNAIL_OPTIMIZE_COMMAND = {
119     "png": "/usr/bin/optipng {filename}",
120     "gif": "/usr/bin/optipng {filename}",
121     "jpeg": "/usr/bin/jpegoptim {filename}",
122 }
123 
124 
125 # python-social-auth
126 # http://psa.matiasaguirre.net/docs/configuration/django.html
127 SOCIAL_AUTH_PIPELINE = (
128     "social.pipeline.social_auth.social_details",
129     "social.pipeline.social_auth.social_uid",
130     "social.pipeline.social_auth.auth_allowed",
131     "social.pipeline.social_auth.social_user",
132     "social.pipeline.user.get_username",
133     "social.pipeline.social_auth.associate_by_email",
134     "social.pipeline.user.create_user",
135     "zds.member.models.save_profile",
136     "social.pipeline.social_auth.associate_user",
137     "social.pipeline.social_auth.load_extra_data",
138     "social.pipeline.user.user_details",
139 )
140 
141 
142 ###############################################################################
143 # ZESTE DE SAVOIR SETTINGS
144 
145 
146 ES_SEARCH_INDEX["shards"] = config["elasticsearch"].get("shards", 3)
147 
148 
149 ZDS_APP["site"]["association"]["email"] = "communication@zestedesavoir.com"
150 
151 # content
152 # ZDS_APP['content']['build_pdf_when_published'] = False
153 ZDS_APP["article"]["repo_path"] = "/opt/zds/data/articles-data"
154 ZDS_APP["content"]["repo_private_path"] = "/opt/zds/data/contents-private"
155 ZDS_APP["content"]["repo_public_path"] = "/opt/zds/data/contents-public"
156 ZDS_APP["content"]["extra_content_generation_policy"] = "WATCHDOG"
157 
158 ZDS_APP["visual_changes"] = zds_config.get("visual_changes", [])
159 
160 ZDS_APP["very_top_banner"] = config.get("very_top_banner", False)
161
```

Path: `zds/settings/abstract_base/requirements.py`
Content:
```
1 from .config import config
2 
3 # best quality, 100 is the same but documentation says
4 # ' values up to 100 are allowed, but this is not recommended'
5 # so let's use 95
6 THUMBNAIL_QUALITY = 95
7 # Let's use the default value BUT if we want to let png in lossless format, we have tu use (png,) instead of None
8 THUMBNAIL_PRESERVE_EXTENSIONS = ("svg",)
9 
10 
11 social_auth_config = config.get("social_auth", {})
12 
13 SOCIAL_AUTH_RAISE_EXCEPTIONS = False
14 
15 SOCIAL_AUTH_FACEBOOK_SCOPE = ["email"]
16 
17 SOCIAL_AUTH_PIPELINE = (
18     "social.pipeline.social_auth.social_details",
19     "social.pipeline.social_auth.social_uid",
20     "social.pipeline.social_auth.auth_allowed",
21     "social.pipeline.social_auth.social_user",
22     "social.pipeline.user.get_username",
23     "social.pipeline.social_auth.associate_by_email",
24     "social.pipeline.user.create_user",
25     "zds.member.models.save_profile",
26     "social.pipeline.social_auth.associate_user",
27     "social.pipeline.social_auth.load_extra_data",
28     "social.pipeline.user.user_details",
29 )
30 
31 # Before adding new providers such as Facebook and Google,
32 # you need to make sure they validate the user's email address on sign up!
33 # If they don't, a malicious person could take control of someone else account!
34 SOCIAL_AUTH_FACEBOOK_KEY = social_auth_config.get("facebook_key", "")
35 SOCIAL_AUTH_FACEBOOK_SECRET = social_auth_config.get("facebook_secret", "")
36 SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = social_auth_config.get(
37     "google_oauth2_key",
38     "696570367703-r6hc7mdd27t1sktdkivpnc5b25i0uip2.apps.googleusercontent.com",
39 )
40 SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = social_auth_config.get(
41     "google_oauth2_secret",
42     "mApWNh3stCsYHwsGuWdbZWP8",
43 )
44 
45 SOCIAL_AUTH_SANITIZE_REDIRECTS = social_auth_config.get(
46     "sanitize_redirects",
47     False,
48 )
49 
50 
51 recaptcha_config = config.get("recaptcha", {})
52 
53 USE_CAPTCHA = recaptcha_config.get("use_captcha", False)
54 # Seems to be used by `django-recaptcha` (what a poorly-namespaced
55 # setting!).
56 # Set to `True` to use the “No Captcha” engine instead of the old API.
57 NOCAPTCHA = True
58 RECAPTCHA_USE_SSL = True
59 RECAPTCHA_PUBLIC_KEY = recaptcha_config.get("public_key", "dummy")
60 RECAPTCHA_PRIVATE_KEY = recaptcha_config.get("private_key", "dummy")
61 
62 
63 OAUTH2_PROVIDER = {"OAUTH2_BACKEND_CLASS": "oauth2_provider.oauth2_backends.JSONOAuthLibCore"}
64
```
--- 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/zds/settings/abstract_base/requirements.py b/zds/settings/abstract_base/requirements.py
--- a/zds/settings/abstract_base/requirements.py
+++ b/zds/settings/abstract_base/requirements.py
@@ -15,17 +15,17 @@
 SOCIAL_AUTH_FACEBOOK_SCOPE = ["email"]
 
 SOCIAL_AUTH_PIPELINE = (
-    "social.pipeline.social_auth.social_details",
-    "social.pipeline.social_auth.social_uid",
-    "social.pipeline.social_auth.auth_allowed",
-    "social.pipeline.social_auth.social_user",
-    "social.pipeline.user.get_username",
-    "social.pipeline.social_auth.associate_by_email",
-    "social.pipeline.user.create_user",
+    "social_core.pipeline.social_auth.social_details",
+    "social_core.pipeline.social_auth.social_uid",
+    "social_core.pipeline.social_auth.auth_allowed",
+    "social_core.pipeline.social_auth.social_user",
+    "social_core.pipeline.user.get_username",
+    "social_core.pipeline.social_auth.associate_by_email",
+    "social_core.pipeline.user.create_user",
     "zds.member.models.save_profile",
-    "social.pipeline.social_auth.associate_user",
-    "social.pipeline.social_auth.load_extra_data",
-    "social.pipeline.user.user_details",
+    "social_core.pipeline.social_auth.associate_user",
+    "social_core.pipeline.social_auth.load_extra_data",
+    "social_core.pipeline.user.user_details",
 )
 
 # Before adding new providers such as Facebook and Google,
diff --git a/zds/settings/prod.py b/zds/settings/prod.py
--- a/zds/settings/prod.py
+++ b/zds/settings/prod.py
@@ -122,23 +122,6 @@
 }
 
 
-# python-social-auth
-# http://psa.matiasaguirre.net/docs/configuration/django.html
-SOCIAL_AUTH_PIPELINE = (
-    "social.pipeline.social_auth.social_details",
-    "social.pipeline.social_auth.social_uid",
-    "social.pipeline.social_auth.auth_allowed",
-    "social.pipeline.social_auth.social_user",
-    "social.pipeline.user.get_username",
-    "social.pipeline.social_auth.associate_by_email",
-    "social.pipeline.user.create_user",
-    "zds.member.models.save_profile",
-    "social.pipeline.social_auth.associate_user",
-    "social.pipeline.social_auth.load_extra_data",
-    "social.pipeline.user.user_details",
-)
-
-
 ###############################################################################
 # ZESTE DE SAVOIR SETTINGS

{"golden_diff": "diff --git a/zds/settings/abstract_base/requirements.py b/zds/settings/abstract_base/requirements.py\n--- a/zds/settings/abstract_base/requirements.py\n+++ b/zds/settings/abstract_base/requirements.py\n@@ -15,17 +15,17 @@\n SOCIAL_AUTH_FACEBOOK_SCOPE = [\"email\"]\n \n SOCIAL_AUTH_PIPELINE = (\n-    \"social.pipeline.social_auth.social_details\",\n-    \"social.pipeline.social_auth.social_uid\",\n-    \"social.pipeline.social_auth.auth_allowed\",\n-    \"social.pipeline.social_auth.social_user\",\n-    \"social.pipeline.user.get_username\",\n-    \"social.pipeline.social_auth.associate_by_email\",\n-    \"social.pipeline.user.create_user\",\n+    \"social_core.pipeline.social_auth.social_details\",\n+    \"social_core.pipeline.social_auth.social_uid\",\n+    \"social_core.pipeline.social_auth.auth_allowed\",\n+    \"social_core.pipeline.social_auth.social_user\",\n+    \"social_core.pipeline.user.get_username\",\n+    \"social_core.pipeline.social_auth.associate_by_email\",\n+    \"social_core.pipeline.user.create_user\",\n     \"zds.member.models.save_profile\",\n-    \"social.pipeline.social_auth.associate_user\",\n-    \"social.pipeline.social_auth.load_extra_data\",\n-    \"social.pipeline.user.user_details\",\n+    \"social_core.pipeline.social_auth.associate_user\",\n+    \"social_core.pipeline.social_auth.load_extra_data\",\n+    \"social_core.pipeline.user.user_details\",\n )\n \n # Before adding new providers such as Facebook and Google,\ndiff --git a/zds/settings/prod.py b/zds/settings/prod.py\n--- a/zds/settings/prod.py\n+++ b/zds/settings/prod.py\n@@ -122,23 +122,6 @@\n }\n \n \n-# python-social-auth\n-# http://psa.matiasaguirre.net/docs/configuration/django.html\n-SOCIAL_AUTH_PIPELINE = (\n-    \"social.pipeline.social_auth.social_details\",\n-    \"social.pipeline.social_auth.social_uid\",\n-    \"social.pipeline.social_auth.auth_allowed\",\n-    \"social.pipeline.social_auth.social_user\",\n-    \"social.pipeline.user.get_username\",\n-    \"social.pipeline.social_auth.associate_by_email\",\n-    \"social.pipeline.user.create_user\",\n-    \"zds.member.models.save_profile\",\n-    \"social.pipeline.social_auth.associate_user\",\n-    \"social.pipeline.social_auth.load_extra_data\",\n-    \"social.pipeline.user.user_details\",\n-)\n-\n-\n ###############################################################################\n # ZESTE DE SAVOIR SETTINGS\n", "issue": "La connexion avec Google ne fonctionne pas sur le serveur de b\u00eata\nProbl\u00e8me rapport\u00e9 par Sentry.\r\n\r\nLa connexion avec Google ne fonctionne pas sur le serveur de b\u00eata, on a une erreur 500 \u00e0 cause d'une erreur dans le paquet social-auth-core. M\u00eame en testant avec la derni\u00e8re version de ce paquet le probl\u00e8me n'est pas corrig\u00e9.\r\n\r\nJ'ai ouvert un ticket chez social-auth-core : https://github.com/python-social-auth/social-core/issues/847\r\n\n", "before_files": [{"content": "from sentry_sdk.integrations.django import DjangoIntegration\nfrom sentry_sdk.integrations.logging import ignore_logger\nimport sentry_sdk\n\nfrom .abstract_base import *\n\n# For secrets, prefer `config[key]` over `config.get(key)` in this\n# file because we really want to raise an error if a secret is not\n# defined.\n\n\n###############################################################################\n# DJANGO SETTINGS\n\n\nDEBUG = False\n\nUSE_L10N = True\n\nDATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.db.backends.mysql\",\n        \"NAME\": config[\"databases\"][\"default\"].get(\"name\", \"zdsdb\"),\n        \"USER\": config[\"databases\"][\"default\"].get(\"user\", \"zds\"),\n        \"PASSWORD\": config[\"databases\"][\"default\"][\"password\"],\n        \"HOST\": \"localhost\",\n        \"PORT\": \"\",\n        \"CONN_MAX_AGE\": 600,\n        \"OPTIONS\": {\n            \"charset\": \"utf8mb4\",\n        },\n    },\n}\n\nALLOWED_HOSTS = [\n    \"beta.zestedesavoir.com\",\n    \"scaleway.zestedesavoir.com\",\n    \"zdsappserver\",\n    \"gandi.zestedesavoir.com\",\n    \"gandi.zestedesavoir.com.\",\n    \".zestedesavoir.com\",\n    \".zestedesavoir.com.\",\n    \"127.0.0.1\",\n    \"localhost\",\n    \"163.172.171.246\",\n]\n\nEMAIL_BACKEND = \"django.core.mail.backends.smtp.EmailBackend\"\nEMAIL_USE_TLS = False\nEMAIL_HOST = \"localhost\"\nEMAIL_PORT = 25\n\nCACHES = {\n    \"default\": {\n        \"BACKEND\": \"django.core.cache.backends.memcached.PyMemcacheCache\",\n        \"LOCATION\": \"127.0.0.1:11211\",\n    }\n}\n\nSESSION_ENGINE = \"django.contrib.sessions.backends.cached_db\"\nSESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 4\n\nMEDIA_ROOT = Path(\"/opt/zds/data/media\")\n\nSTATIC_ROOT = Path(\"/opt/zds/data/static\")\nSTATICFILES_STORAGE = \"django.contrib.staticfiles.storage.ManifestStaticFilesStorage\"\n\ndjango_template_engine[\"APP_DIRS\"] = False\ndjango_template_engine[\"OPTIONS\"][\"loaders\"] = [\n    (\n        \"django.template.loaders.cached.Loader\",\n        [\n            \"django.template.loaders.filesystem.Loader\",\n            \"django.template.loaders.app_directories.Loader\",\n        ],\n    ),\n]\n\n\ndef _get_version():\n    from zds import __version__, git_version\n\n    if git_version is None:\n        return __version__\n    else:\n        return f\"{__version__}/{git_version[:7]}\"\n\n\nsentry_sdk.init(\n    dsn=config[\"sentry\"][\"dsn\"],\n    integrations=[DjangoIntegration()],\n    # Set traces_sample_rate to 1.0 to capture 100%\n    # of transactions for performance monitoring.\n    # We recommend adjusting this value in production,\n    traces_sample_rate=1.0,\n    # If you wish to associate users to errors (assuming you are using\n    # django.contrib.auth) you may enable sending PII data.\n    send_default_pii=True,\n    # By default the SDK will try to use the SENTRY_RELEASE\n    # environment variable, or infer a git commit\n    # SHA as release, however you may want to set\n    # something more human-readable.\n    release=_get_version().replace(\"/\", \"#\"),\n    # /!\\ It cannot contain slashes\n    environment=config[\"sentry\"][\"environment\"],\n)\n\n# Ignoring emarkdown logging because it is too noisy\nignore_logger(\"zds.utils.templatetags.emarkdown\")\n\n\n###############################################################################\n# REQUIREMENTS SETTINGS\n\n\n# easy-thumbnails\n# http://easy-thumbnails.readthedocs.io/en/2.1/ref/optimize/\nTHUMBNAIL_OPTIMIZE_COMMAND = {\n    \"png\": \"/usr/bin/optipng {filename}\",\n    \"gif\": \"/usr/bin/optipng {filename}\",\n    \"jpeg\": \"/usr/bin/jpegoptim {filename}\",\n}\n\n\n# python-social-auth\n# http://psa.matiasaguirre.net/docs/configuration/django.html\nSOCIAL_AUTH_PIPELINE = (\n    \"social.pipeline.social_auth.social_details\",\n    \"social.pipeline.social_auth.social_uid\",\n    \"social.pipeline.social_auth.auth_allowed\",\n    \"social.pipeline.social_auth.social_user\",\n    \"social.pipeline.user.get_username\",\n    \"social.pipeline.social_auth.associate_by_email\",\n    \"social.pipeline.user.create_user\",\n    \"zds.member.models.save_profile\",\n    \"social.pipeline.social_auth.associate_user\",\n    \"social.pipeline.social_auth.load_extra_data\",\n    \"social.pipeline.user.user_details\",\n)\n\n\n###############################################################################\n# ZESTE DE SAVOIR SETTINGS\n\n\nES_SEARCH_INDEX[\"shards\"] = config[\"elasticsearch\"].get(\"shards\", 3)\n\n\nZDS_APP[\"site\"][\"association\"][\"email\"] = \"communication@zestedesavoir.com\"\n\n# content\n# ZDS_APP['content']['build_pdf_when_published'] = False\nZDS_APP[\"article\"][\"repo_path\"] = \"/opt/zds/data/articles-data\"\nZDS_APP[\"content\"][\"repo_private_path\"] = \"/opt/zds/data/contents-private\"\nZDS_APP[\"content\"][\"repo_public_path\"] = \"/opt/zds/data/contents-public\"\nZDS_APP[\"content\"][\"extra_content_generation_policy\"] = \"WATCHDOG\"\n\nZDS_APP[\"visual_changes\"] = zds_config.get(\"visual_changes\", [])\n\nZDS_APP[\"very_top_banner\"] = config.get(\"very_top_banner\", False)\n", "path": "zds/settings/prod.py"}, {"content": "from .config import config\n\n# best quality, 100 is the same but documentation says\n# ' values up to 100 are allowed, but this is not recommended'\n# so let's use 95\nTHUMBNAIL_QUALITY = 95\n# Let's use the default value BUT if we want to let png in lossless format, we have tu use (png,) instead of None\nTHUMBNAIL_PRESERVE_EXTENSIONS = (\"svg\",)\n\n\nsocial_auth_config = config.get(\"social_auth\", {})\n\nSOCIAL_AUTH_RAISE_EXCEPTIONS = False\n\nSOCIAL_AUTH_FACEBOOK_SCOPE = [\"email\"]\n\nSOCIAL_AUTH_PIPELINE = (\n    \"social.pipeline.social_auth.social_details\",\n    \"social.pipeline.social_auth.social_uid\",\n    \"social.pipeline.social_auth.auth_allowed\",\n    \"social.pipeline.social_auth.social_user\",\n    \"social.pipeline.user.get_username\",\n    \"social.pipeline.social_auth.associate_by_email\",\n    \"social.pipeline.user.create_user\",\n    \"zds.member.models.save_profile\",\n    \"social.pipeline.social_auth.associate_user\",\n    \"social.pipeline.social_auth.load_extra_data\",\n    \"social.pipeline.user.user_details\",\n)\n\n# Before adding new providers such as Facebook and Google,\n# you need to make sure they validate the user's email address on sign up!\n# If they don't, a malicious person could take control of someone else account!\nSOCIAL_AUTH_FACEBOOK_KEY = social_auth_config.get(\"facebook_key\", \"\")\nSOCIAL_AUTH_FACEBOOK_SECRET = social_auth_config.get(\"facebook_secret\", \"\")\nSOCIAL_AUTH_GOOGLE_OAUTH2_KEY = social_auth_config.get(\n    \"google_oauth2_key\",\n    \"696570367703-r6hc7mdd27t1sktdkivpnc5b25i0uip2.apps.googleusercontent.com\",\n)\nSOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = social_auth_config.get(\n    \"google_oauth2_secret\",\n    \"mApWNh3stCsYHwsGuWdbZWP8\",\n)\n\nSOCIAL_AUTH_SANITIZE_REDIRECTS = social_auth_config.get(\n    \"sanitize_redirects\",\n    False,\n)\n\n\nrecaptcha_config = config.get(\"recaptcha\", {})\n\nUSE_CAPTCHA = recaptcha_config.get(\"use_captcha\", False)\n# Seems to be used by `django-recaptcha` (what a poorly-namespaced\n# setting!).\n# Set to `True` to use the \u201cNo Captcha\u201d engine instead of the old API.\nNOCAPTCHA = True\nRECAPTCHA_USE_SSL = True\nRECAPTCHA_PUBLIC_KEY = recaptcha_config.get(\"public_key\", \"dummy\")\nRECAPTCHA_PRIVATE_KEY = recaptcha_config.get(\"private_key\", \"dummy\")\n\n\nOAUTH2_PROVIDER = {\"OAUTH2_BACKEND_CLASS\": \"oauth2_provider.oauth2_backends.JSONOAuthLibCore\"}\n", "path": "zds/settings/abstract_base/requirements.py"}], "after_files": [{"content": "from sentry_sdk.integrations.django import DjangoIntegration\nfrom sentry_sdk.integrations.logging import ignore_logger\nimport sentry_sdk\n\nfrom .abstract_base import *\n\n# For secrets, prefer `config[key]` over `config.get(key)` in this\n# file because we really want to raise an error if a secret is not\n# defined.\n\n\n###############################################################################\n# DJANGO SETTINGS\n\n\nDEBUG = False\n\nUSE_L10N = True\n\nDATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.db.backends.mysql\",\n        \"NAME\": config[\"databases\"][\"default\"].get(\"name\", \"zdsdb\"),\n        \"USER\": config[\"databases\"][\"default\"].get(\"user\", \"zds\"),\n        \"PASSWORD\": config[\"databases\"][\"default\"][\"password\"],\n        \"HOST\": \"localhost\",\n        \"PORT\": \"\",\n        \"CONN_MAX_AGE\": 600,\n        \"OPTIONS\": {\n            \"charset\": \"utf8mb4\",\n        },\n    },\n}\n\nALLOWED_HOSTS = [\n    \"beta.zestedesavoir.com\",\n    \"scaleway.zestedesavoir.com\",\n    \"zdsappserver\",\n    \"gandi.zestedesavoir.com\",\n    \"gandi.zestedesavoir.com.\",\n    \".zestedesavoir.com\",\n    \".zestedesavoir.com.\",\n    \"127.0.0.1\",\n    \"localhost\",\n    \"163.172.171.246\",\n]\n\nEMAIL_BACKEND = \"django.core.mail.backends.smtp.EmailBackend\"\nEMAIL_USE_TLS = False\nEMAIL_HOST = \"localhost\"\nEMAIL_PORT = 25\n\nCACHES = {\n    \"default\": {\n        \"BACKEND\": \"django.core.cache.backends.memcached.PyMemcacheCache\",\n        \"LOCATION\": \"127.0.0.1:11211\",\n    }\n}\n\nSESSION_ENGINE = \"django.contrib.sessions.backends.cached_db\"\nSESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 4\n\nMEDIA_ROOT = Path(\"/opt/zds/data/media\")\n\nSTATIC_ROOT = Path(\"/opt/zds/data/static\")\nSTATICFILES_STORAGE = \"django.contrib.staticfiles.storage.ManifestStaticFilesStorage\"\n\ndjango_template_engine[\"APP_DIRS\"] = False\ndjango_template_engine[\"OPTIONS\"][\"loaders\"] = [\n    (\n        \"django.template.loaders.cached.Loader\",\n        [\n            \"django.template.loaders.filesystem.Loader\",\n            \"django.template.loaders.app_directories.Loader\",\n        ],\n    ),\n]\n\n\ndef _get_version():\n    from zds import __version__, git_version\n\n    if git_version is None:\n        return __version__\n    else:\n        return f\"{__version__}/{git_version[:7]}\"\n\n\nsentry_sdk.init(\n    dsn=config[\"sentry\"][\"dsn\"],\n    integrations=[DjangoIntegration()],\n    # Set traces_sample_rate to 1.0 to capture 100%\n    # of transactions for performance monitoring.\n    # We recommend adjusting this value in production,\n    traces_sample_rate=1.0,\n    # If you wish to associate users to errors (assuming you are using\n    # django.contrib.auth) you may enable sending PII data.\n    send_default_pii=True,\n    # By default the SDK will try to use the SENTRY_RELEASE\n    # environment variable, or infer a git commit\n    # SHA as release, however you may want to set\n    # something more human-readable.\n    release=_get_version().replace(\"/\", \"#\"),\n    # /!\\ It cannot contain slashes\n    environment=config[\"sentry\"][\"environment\"],\n)\n\n# Ignoring emarkdown logging because it is too noisy\nignore_logger(\"zds.utils.templatetags.emarkdown\")\n\n\n###############################################################################\n# REQUIREMENTS SETTINGS\n\n\n# easy-thumbnails\n# http://easy-thumbnails.readthedocs.io/en/2.1/ref/optimize/\nTHUMBNAIL_OPTIMIZE_COMMAND = {\n    \"png\": \"/usr/bin/optipng {filename}\",\n    \"gif\": \"/usr/bin/optipng {filename}\",\n    \"jpeg\": \"/usr/bin/jpegoptim {filename}\",\n}\n\n\n###############################################################################\n# ZESTE DE SAVOIR SETTINGS\n\n\nES_SEARCH_INDEX[\"shards\"] = config[\"elasticsearch\"].get(\"shards\", 3)\n\n\nZDS_APP[\"site\"][\"association\"][\"email\"] = \"communication@zestedesavoir.com\"\n\n# content\n# ZDS_APP['content']['build_pdf_when_published'] = False\nZDS_APP[\"article\"][\"repo_path\"] = \"/opt/zds/data/articles-data\"\nZDS_APP[\"content\"][\"repo_private_path\"] = \"/opt/zds/data/contents-private\"\nZDS_APP[\"content\"][\"repo_public_path\"] = \"/opt/zds/data/contents-public\"\nZDS_APP[\"content\"][\"extra_content_generation_policy\"] = \"WATCHDOG\"\n\nZDS_APP[\"visual_changes\"] = zds_config.get(\"visual_changes\", [])\n\nZDS_APP[\"very_top_banner\"] = config.get(\"very_top_banner\", False)\n", "path": "zds/settings/prod.py"}, {"content": "from .config import config\n\n# best quality, 100 is the same but documentation says\n# ' values up to 100 are allowed, but this is not recommended'\n# so let's use 95\nTHUMBNAIL_QUALITY = 95\n# Let's use the default value BUT if we want to let png in lossless format, we have tu use (png,) instead of None\nTHUMBNAIL_PRESERVE_EXTENSIONS = (\"svg\",)\n\n\nsocial_auth_config = config.get(\"social_auth\", {})\n\nSOCIAL_AUTH_RAISE_EXCEPTIONS = False\n\nSOCIAL_AUTH_FACEBOOK_SCOPE = [\"email\"]\n\nSOCIAL_AUTH_PIPELINE = (\n    \"social_core.pipeline.social_auth.social_details\",\n    \"social_core.pipeline.social_auth.social_uid\",\n    \"social_core.pipeline.social_auth.auth_allowed\",\n    \"social_core.pipeline.social_auth.social_user\",\n    \"social_core.pipeline.user.get_username\",\n    \"social_core.pipeline.social_auth.associate_by_email\",\n    \"social_core.pipeline.user.create_user\",\n    \"zds.member.models.save_profile\",\n    \"social_core.pipeline.social_auth.associate_user\",\n    \"social_core.pipeline.social_auth.load_extra_data\",\n    \"social_core.pipeline.user.user_details\",\n)\n\n# Before adding new providers such as Facebook and Google,\n# you need to make sure they validate the user's email address on sign up!\n# If they don't, a malicious person could take control of someone else account!\nSOCIAL_AUTH_FACEBOOK_KEY = social_auth_config.get(\"facebook_key\", \"\")\nSOCIAL_AUTH_FACEBOOK_SECRET = social_auth_config.get(\"facebook_secret\", \"\")\nSOCIAL_AUTH_GOOGLE_OAUTH2_KEY = social_auth_config.get(\n    \"google_oauth2_key\",\n    \"696570367703-r6hc7mdd27t1sktdkivpnc5b25i0uip2.apps.googleusercontent.com\",\n)\nSOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = social_auth_config.get(\n    \"google_oauth2_secret\",\n    \"mApWNh3stCsYHwsGuWdbZWP8\",\n)\n\nSOCIAL_AUTH_SANITIZE_REDIRECTS = social_auth_config.get(\n    \"sanitize_redirects\",\n    False,\n)\n\n\nrecaptcha_config = config.get(\"recaptcha\", {})\n\nUSE_CAPTCHA = recaptcha_config.get(\"use_captcha\", False)\n# Seems to be used by `django-recaptcha` (what a poorly-namespaced\n# setting!).\n# Set to `True` to use the \u201cNo Captcha\u201d engine instead of the old API.\nNOCAPTCHA = True\nRECAPTCHA_USE_SSL = True\nRECAPTCHA_PUBLIC_KEY = recaptcha_config.get(\"public_key\", \"dummy\")\nRECAPTCHA_PRIVATE_KEY = recaptcha_config.get(\"private_key\", \"dummy\")\n\n\nOAUTH2_PROVIDER = {\"OAUTH2_BACKEND_CLASS\": \"oauth2_provider.oauth2_backends.JSONOAuthLibCore\"}\n", "path": "zds/settings/abstract_base/requirements.py"}]}