We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Unable to post review in Safari on iPadOS
**Describe the bug**
When trying to post a long-ish review in Safari on iPadOS (desktop mode, content blockers disabled), the post button shows the spinner introduced with #1388, but the posting never concludes.

**To Reproduce**
Steps to reproduce the behavior:
1. Get an iPad pro 13.9” running iPadOS 14.7.1
2. Open your bookwyrm.social account in Safari, ensuring it runs in desktop mode and content blockers are disabled
3. Write a review of at least 2700 chars
4. Try to post it

**Expected behavior**
After some spinning, the review appears on your feed.

**Instance**
bookwyrm.social

**Extra context**
[Book I’m trying to review](https://bookwyrm.social/book/214201).

---

**Device Info:**
    - Device: iPad pro 2nd gen 13.9”
    - OS: iPadOS 14.7.1
    - Browser: Safari
    - Version N/A

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bookwyrm/settings.py`
Content:
```
1 """ bookwyrm settings and configuration """
2 import os
3 from environs import Env
4 
5 import requests
6 from django.utils.translation import gettext_lazy as _
7 
8 
9 env = Env()
10 DOMAIN = env("DOMAIN")
11 VERSION = "0.0.1"
12 
13 PAGE_LENGTH = env("PAGE_LENGTH", 15)
14 DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
15 
16 JS_CACHE = "19447742"
17 
18 # email
19 EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend")
20 EMAIL_HOST = env("EMAIL_HOST")
21 EMAIL_PORT = env("EMAIL_PORT", 587)
22 EMAIL_HOST_USER = env("EMAIL_HOST_USER")
23 EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
24 EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", True)
25 EMAIL_USE_SSL = env.bool("EMAIL_USE_SSL", False)
26 DEFAULT_FROM_EMAIL = "admin@{:s}".format(env("DOMAIN"))
27 
28 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
29 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
30 LOCALE_PATHS = [
31     os.path.join(BASE_DIR, "locale"),
32 ]
33 
34 DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
35 
36 # Preview image
37 ENABLE_PREVIEW_IMAGES = env.bool("ENABLE_PREVIEW_IMAGES", False)
38 PREVIEW_BG_COLOR = env.str("PREVIEW_BG_COLOR", "use_dominant_color_light")
39 PREVIEW_TEXT_COLOR = env.str("PREVIEW_TEXT_COLOR", "#363636")
40 PREVIEW_IMG_WIDTH = env.int("PREVIEW_IMG_WIDTH", 1200)
41 PREVIEW_IMG_HEIGHT = env.int("PREVIEW_IMG_HEIGHT", 630)
42 PREVIEW_DEFAULT_COVER_COLOR = env.str("PREVIEW_DEFAULT_COVER_COLOR", "#002549")
43 
44 # Quick-start development settings - unsuitable for production
45 # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
46 
47 # SECURITY WARNING: keep the secret key used in production secret!
48 SECRET_KEY = env("SECRET_KEY")
49 
50 # SECURITY WARNING: don't run with debug turned on in production!
51 DEBUG = env.bool("DEBUG", True)
52 USE_HTTPS = env.bool("USE_HTTPS", False)
53 
54 ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", ["*"])
55 
56 # Application definition
57 
58 INSTALLED_APPS = [
59     "django.contrib.admin",
60     "django.contrib.auth",
61     "django.contrib.contenttypes",
62     "django.contrib.sessions",
63     "django.contrib.messages",
64     "django.contrib.staticfiles",
65     "django.contrib.humanize",
66     "django_rename_app",
67     "bookwyrm",
68     "celery",
69     "imagekit",
70     "storages",
71 ]
72 
73 MIDDLEWARE = [
74     "django.middleware.security.SecurityMiddleware",
75     "django.contrib.sessions.middleware.SessionMiddleware",
76     "django.middleware.locale.LocaleMiddleware",
77     "django.middleware.common.CommonMiddleware",
78     "django.middleware.csrf.CsrfViewMiddleware",
79     "django.contrib.auth.middleware.AuthenticationMiddleware",
80     "bookwyrm.timezone_middleware.TimezoneMiddleware",
81     "django.contrib.messages.middleware.MessageMiddleware",
82     "django.middleware.clickjacking.XFrameOptionsMiddleware",
83 ]
84 
85 ROOT_URLCONF = "bookwyrm.urls"
86 
87 TEMPLATES = [
88     {
89         "BACKEND": "django.template.backends.django.DjangoTemplates",
90         "DIRS": ["templates"],
91         "APP_DIRS": True,
92         "OPTIONS": {
93             "context_processors": [
94                 "django.template.context_processors.debug",
95                 "django.template.context_processors.request",
96                 "django.contrib.auth.context_processors.auth",
97                 "django.contrib.messages.context_processors.messages",
98                 "bookwyrm.context_processors.site_settings",
99             ],
100         },
101     },
102 ]
103 
104 
105 WSGI_APPLICATION = "bookwyrm.wsgi.application"
106 
107 # redis/activity streams settings
108 REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost")
109 REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379)
110 REDIS_ACTIVITY_PASSWORD = env("REDIS_ACTIVITY_PASSWORD", None)
111 
112 MAX_STREAM_LENGTH = int(env("MAX_STREAM_LENGTH", 200))
113 
114 STREAMS = [
115     {"key": "home", "name": _("Home Timeline"), "shortname": _("Home")},
116     {"key": "books", "name": _("Books Timeline"), "shortname": _("Books")},
117 ]
118 
119 # Database
120 # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
121 
122 DATABASES = {
123     "default": {
124         "ENGINE": "django.db.backends.postgresql_psycopg2",
125         "NAME": env("POSTGRES_DB", "fedireads"),
126         "USER": env("POSTGRES_USER", "fedireads"),
127         "PASSWORD": env("POSTGRES_PASSWORD", "fedireads"),
128         "HOST": env("POSTGRES_HOST", ""),
129         "PORT": env("POSTGRES_PORT", 5432),
130     },
131 }
132 
133 
134 LOGIN_URL = "/login/"
135 AUTH_USER_MODEL = "bookwyrm.User"
136 
137 # Password validation
138 # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
139 
140 # pylint: disable=line-too-long
141 AUTH_PASSWORD_VALIDATORS = [
142     {
143         "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
144     },
145     {
146         "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
147     },
148     {
149         "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
150     },
151     {
152         "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
153     },
154 ]
155 
156 
157 # Internationalization
158 # https://docs.djangoproject.com/en/3.2/topics/i18n/
159 
160 LANGUAGE_CODE = "en-us"
161 LANGUAGES = [
162     ("en-us", _("English")),
163     ("de-de", _("German")),
164     ("es", _("Spanish")),
165     ("fr-fr", _("French")),
166     ("zh-hans", _("Simplified Chinese")),
167     ("zh-hant", _("Traditional Chinese")),
168 ]
169 
170 
171 TIME_ZONE = "UTC"
172 
173 USE_I18N = True
174 
175 USE_L10N = True
176 
177 USE_TZ = True
178 
179 
180 USER_AGENT = "%s (BookWyrm/%s; +https://%s/)" % (
181     requests.utils.default_user_agent(),
182     VERSION,
183     DOMAIN,
184 )
185 
186 # Imagekit generated thumbnails
187 ENABLE_THUMBNAIL_GENERATION = env.bool("ENABLE_THUMBNAIL_GENERATION", False)
188 IMAGEKIT_CACHEFILE_DIR = "thumbnails"
189 
190 # Static files (CSS, JavaScript, Images)
191 # https://docs.djangoproject.com/en/3.2/howto/static-files/
192 
193 PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
194 
195 # Storage
196 
197 PROTOCOL = "http"
198 if USE_HTTPS:
199     PROTOCOL = "https"
200 
201 USE_S3 = env.bool("USE_S3", False)
202 
203 if USE_S3:
204     # AWS settings
205     AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
206     AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
207     AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME")
208     AWS_S3_CUSTOM_DOMAIN = env("AWS_S3_CUSTOM_DOMAIN")
209     AWS_S3_REGION_NAME = env("AWS_S3_REGION_NAME", "")
210     AWS_S3_ENDPOINT_URL = env("AWS_S3_ENDPOINT_URL")
211     AWS_DEFAULT_ACL = "public-read"
212     AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
213     # S3 Static settings
214     STATIC_LOCATION = "static"
215     STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATIC_LOCATION)
216     STATICFILES_STORAGE = "bookwyrm.storage_backends.StaticStorage"
217     # S3 Media settings
218     MEDIA_LOCATION = "images"
219     MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIA_LOCATION)
220     MEDIA_FULL_URL = MEDIA_URL
221     DEFAULT_FILE_STORAGE = "bookwyrm.storage_backends.ImagesStorage"
222     # I don't know if it's used, but the site crashes without it
223     STATIC_ROOT = os.path.join(BASE_DIR, env("STATIC_ROOT", "static"))
224     MEDIA_ROOT = os.path.join(BASE_DIR, env("MEDIA_ROOT", "images"))
225 else:
226     STATIC_URL = "/static/"
227     STATIC_ROOT = os.path.join(BASE_DIR, env("STATIC_ROOT", "static"))
228     MEDIA_URL = "/images/"
229     MEDIA_FULL_URL = "%s://%s%s" % (PROTOCOL, DOMAIN, MEDIA_URL)
230     MEDIA_ROOT = os.path.join(BASE_DIR, env("MEDIA_ROOT", "images"))
231
```
--- 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/bookwyrm/settings.py b/bookwyrm/settings.py
--- a/bookwyrm/settings.py
+++ b/bookwyrm/settings.py
@@ -13,7 +13,7 @@
 PAGE_LENGTH = env("PAGE_LENGTH", 15)
 DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
 
-JS_CACHE = "19447742"
+JS_CACHE = "e5832a26"
 
 # email
 EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend")

{"golden_diff": "diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py\n--- a/bookwyrm/settings.py\n+++ b/bookwyrm/settings.py\n@@ -13,7 +13,7 @@\n PAGE_LENGTH = env(\"PAGE_LENGTH\", 15)\n DEFAULT_LANGUAGE = env(\"DEFAULT_LANGUAGE\", \"English\")\n \n-JS_CACHE = \"19447742\"\n+JS_CACHE = \"e5832a26\"\n \n # email\n EMAIL_BACKEND = env(\"EMAIL_BACKEND\", \"django.core.mail.backends.smtp.EmailBackend\")\n", "issue": "Unable to post review in Safari on iPadOS\n**Describe the bug**\nWhen trying to post a long-ish review in Safari on iPadOS (desktop mode, content blockers disabled), the post button shows the spinner introduced with #1388, but the posting never concludes.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Get an iPad pro 13.9\u201d running iPadOS 14.7.1\n2. Open your bookwyrm.social account in Safari, ensuring it runs in desktop mode and content blockers are disabled\n3. Write a review of at least 2700 chars\n4. Try to post it\n\n**Expected behavior**\nAfter some spinning, the review appears on your feed.\n\n**Instance**\nbookwyrm.social\n\n**Extra context**\n[Book I\u2019m trying to review](https://bookwyrm.social/book/214201).\n\n---\n\n**Device Info:**\n    - Device: iPad pro 2nd gen 13.9\u201d\n    - OS: iPadOS 14.7.1\n    - Browser: Safari\n    - Version N/A\n", "before_files": [{"content": "\"\"\" bookwyrm settings and configuration \"\"\"\nimport os\nfrom environs import Env\n\nimport requests\nfrom django.utils.translation import gettext_lazy as _\n\n\nenv = Env()\nDOMAIN = env(\"DOMAIN\")\nVERSION = \"0.0.1\"\n\nPAGE_LENGTH = env(\"PAGE_LENGTH\", 15)\nDEFAULT_LANGUAGE = env(\"DEFAULT_LANGUAGE\", \"English\")\n\nJS_CACHE = \"19447742\"\n\n# email\nEMAIL_BACKEND = env(\"EMAIL_BACKEND\", \"django.core.mail.backends.smtp.EmailBackend\")\nEMAIL_HOST = env(\"EMAIL_HOST\")\nEMAIL_PORT = env(\"EMAIL_PORT\", 587)\nEMAIL_HOST_USER = env(\"EMAIL_HOST_USER\")\nEMAIL_HOST_PASSWORD = env(\"EMAIL_HOST_PASSWORD\")\nEMAIL_USE_TLS = env.bool(\"EMAIL_USE_TLS\", True)\nEMAIL_USE_SSL = env.bool(\"EMAIL_USE_SSL\", False)\nDEFAULT_FROM_EMAIL = \"admin@{:s}\".format(env(\"DOMAIN\"))\n\n# Build paths inside the project like this: os.path.join(BASE_DIR, ...)\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nLOCALE_PATHS = [\n    os.path.join(BASE_DIR, \"locale\"),\n]\n\nDEFAULT_AUTO_FIELD = \"django.db.models.AutoField\"\n\n# Preview image\nENABLE_PREVIEW_IMAGES = env.bool(\"ENABLE_PREVIEW_IMAGES\", False)\nPREVIEW_BG_COLOR = env.str(\"PREVIEW_BG_COLOR\", \"use_dominant_color_light\")\nPREVIEW_TEXT_COLOR = env.str(\"PREVIEW_TEXT_COLOR\", \"#363636\")\nPREVIEW_IMG_WIDTH = env.int(\"PREVIEW_IMG_WIDTH\", 1200)\nPREVIEW_IMG_HEIGHT = env.int(\"PREVIEW_IMG_HEIGHT\", 630)\nPREVIEW_DEFAULT_COVER_COLOR = env.str(\"PREVIEW_DEFAULT_COVER_COLOR\", \"#002549\")\n\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = env(\"SECRET_KEY\")\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = env.bool(\"DEBUG\", True)\nUSE_HTTPS = env.bool(\"USE_HTTPS\", False)\n\nALLOWED_HOSTS = env.list(\"ALLOWED_HOSTS\", [\"*\"])\n\n# Application definition\n\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \"django.contrib.humanize\",\n    \"django_rename_app\",\n    \"bookwyrm\",\n    \"celery\",\n    \"imagekit\",\n    \"storages\",\n]\n\nMIDDLEWARE = [\n    \"django.middleware.security.SecurityMiddleware\",\n    \"django.contrib.sessions.middleware.SessionMiddleware\",\n    \"django.middleware.locale.LocaleMiddleware\",\n    \"django.middleware.common.CommonMiddleware\",\n    \"django.middleware.csrf.CsrfViewMiddleware\",\n    \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n    \"bookwyrm.timezone_middleware.TimezoneMiddleware\",\n    \"django.contrib.messages.middleware.MessageMiddleware\",\n    \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n]\n\nROOT_URLCONF = \"bookwyrm.urls\"\n\nTEMPLATES = [\n    {\n        \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n        \"DIRS\": [\"templates\"],\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                \"bookwyrm.context_processors.site_settings\",\n            ],\n        },\n    },\n]\n\n\nWSGI_APPLICATION = \"bookwyrm.wsgi.application\"\n\n# redis/activity streams settings\nREDIS_ACTIVITY_HOST = env(\"REDIS_ACTIVITY_HOST\", \"localhost\")\nREDIS_ACTIVITY_PORT = env(\"REDIS_ACTIVITY_PORT\", 6379)\nREDIS_ACTIVITY_PASSWORD = env(\"REDIS_ACTIVITY_PASSWORD\", None)\n\nMAX_STREAM_LENGTH = int(env(\"MAX_STREAM_LENGTH\", 200))\n\nSTREAMS = [\n    {\"key\": \"home\", \"name\": _(\"Home Timeline\"), \"shortname\": _(\"Home\")},\n    {\"key\": \"books\", \"name\": _(\"Books Timeline\"), \"shortname\": _(\"Books\")},\n]\n\n# Database\n# https://docs.djangoproject.com/en/3.2/ref/settings/#databases\n\nDATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.db.backends.postgresql_psycopg2\",\n        \"NAME\": env(\"POSTGRES_DB\", \"fedireads\"),\n        \"USER\": env(\"POSTGRES_USER\", \"fedireads\"),\n        \"PASSWORD\": env(\"POSTGRES_PASSWORD\", \"fedireads\"),\n        \"HOST\": env(\"POSTGRES_HOST\", \"\"),\n        \"PORT\": env(\"POSTGRES_PORT\", 5432),\n    },\n}\n\n\nLOGIN_URL = \"/login/\"\nAUTH_USER_MODEL = \"bookwyrm.User\"\n\n# Password validation\n# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators\n\n# pylint: disable=line-too-long\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\",\n    },\n]\n\n\n# Internationalization\n# https://docs.djangoproject.com/en/3.2/topics/i18n/\n\nLANGUAGE_CODE = \"en-us\"\nLANGUAGES = [\n    (\"en-us\", _(\"English\")),\n    (\"de-de\", _(\"German\")),\n    (\"es\", _(\"Spanish\")),\n    (\"fr-fr\", _(\"French\")),\n    (\"zh-hans\", _(\"Simplified Chinese\")),\n    (\"zh-hant\", _(\"Traditional Chinese\")),\n]\n\n\nTIME_ZONE = \"UTC\"\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n\nUSER_AGENT = \"%s (BookWyrm/%s; +https://%s/)\" % (\n    requests.utils.default_user_agent(),\n    VERSION,\n    DOMAIN,\n)\n\n# Imagekit generated thumbnails\nENABLE_THUMBNAIL_GENERATION = env.bool(\"ENABLE_THUMBNAIL_GENERATION\", False)\nIMAGEKIT_CACHEFILE_DIR = \"thumbnails\"\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/3.2/howto/static-files/\n\nPROJECT_DIR = os.path.dirname(os.path.abspath(__file__))\n\n# Storage\n\nPROTOCOL = \"http\"\nif USE_HTTPS:\n    PROTOCOL = \"https\"\n\nUSE_S3 = env.bool(\"USE_S3\", False)\n\nif USE_S3:\n    # AWS settings\n    AWS_ACCESS_KEY_ID = env(\"AWS_ACCESS_KEY_ID\")\n    AWS_SECRET_ACCESS_KEY = env(\"AWS_SECRET_ACCESS_KEY\")\n    AWS_STORAGE_BUCKET_NAME = env(\"AWS_STORAGE_BUCKET_NAME\")\n    AWS_S3_CUSTOM_DOMAIN = env(\"AWS_S3_CUSTOM_DOMAIN\")\n    AWS_S3_REGION_NAME = env(\"AWS_S3_REGION_NAME\", \"\")\n    AWS_S3_ENDPOINT_URL = env(\"AWS_S3_ENDPOINT_URL\")\n    AWS_DEFAULT_ACL = \"public-read\"\n    AWS_S3_OBJECT_PARAMETERS = {\"CacheControl\": \"max-age=86400\"}\n    # S3 Static settings\n    STATIC_LOCATION = \"static\"\n    STATIC_URL = \"https://%s/%s/\" % (AWS_S3_CUSTOM_DOMAIN, STATIC_LOCATION)\n    STATICFILES_STORAGE = \"bookwyrm.storage_backends.StaticStorage\"\n    # S3 Media settings\n    MEDIA_LOCATION = \"images\"\n    MEDIA_URL = \"https://%s/%s/\" % (AWS_S3_CUSTOM_DOMAIN, MEDIA_LOCATION)\n    MEDIA_FULL_URL = MEDIA_URL\n    DEFAULT_FILE_STORAGE = \"bookwyrm.storage_backends.ImagesStorage\"\n    # I don't know if it's used, but the site crashes without it\n    STATIC_ROOT = os.path.join(BASE_DIR, env(\"STATIC_ROOT\", \"static\"))\n    MEDIA_ROOT = os.path.join(BASE_DIR, env(\"MEDIA_ROOT\", \"images\"))\nelse:\n    STATIC_URL = \"/static/\"\n    STATIC_ROOT = os.path.join(BASE_DIR, env(\"STATIC_ROOT\", \"static\"))\n    MEDIA_URL = \"/images/\"\n    MEDIA_FULL_URL = \"%s://%s%s\" % (PROTOCOL, DOMAIN, MEDIA_URL)\n    MEDIA_ROOT = os.path.join(BASE_DIR, env(\"MEDIA_ROOT\", \"images\"))\n", "path": "bookwyrm/settings.py"}], "after_files": [{"content": "\"\"\" bookwyrm settings and configuration \"\"\"\nimport os\nfrom environs import Env\n\nimport requests\nfrom django.utils.translation import gettext_lazy as _\n\n\nenv = Env()\nDOMAIN = env(\"DOMAIN\")\nVERSION = \"0.0.1\"\n\nPAGE_LENGTH = env(\"PAGE_LENGTH\", 15)\nDEFAULT_LANGUAGE = env(\"DEFAULT_LANGUAGE\", \"English\")\n\nJS_CACHE = \"e5832a26\"\n\n# email\nEMAIL_BACKEND = env(\"EMAIL_BACKEND\", \"django.core.mail.backends.smtp.EmailBackend\")\nEMAIL_HOST = env(\"EMAIL_HOST\")\nEMAIL_PORT = env(\"EMAIL_PORT\", 587)\nEMAIL_HOST_USER = env(\"EMAIL_HOST_USER\")\nEMAIL_HOST_PASSWORD = env(\"EMAIL_HOST_PASSWORD\")\nEMAIL_USE_TLS = env.bool(\"EMAIL_USE_TLS\", True)\nEMAIL_USE_SSL = env.bool(\"EMAIL_USE_SSL\", False)\nDEFAULT_FROM_EMAIL = \"admin@{:s}\".format(env(\"DOMAIN\"))\n\n# Build paths inside the project like this: os.path.join(BASE_DIR, ...)\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nLOCALE_PATHS = [\n    os.path.join(BASE_DIR, \"locale\"),\n]\n\nDEFAULT_AUTO_FIELD = \"django.db.models.AutoField\"\n\n# Preview image\nENABLE_PREVIEW_IMAGES = env.bool(\"ENABLE_PREVIEW_IMAGES\", False)\nPREVIEW_BG_COLOR = env.str(\"PREVIEW_BG_COLOR\", \"use_dominant_color_light\")\nPREVIEW_TEXT_COLOR = env.str(\"PREVIEW_TEXT_COLOR\", \"#363636\")\nPREVIEW_IMG_WIDTH = env.int(\"PREVIEW_IMG_WIDTH\", 1200)\nPREVIEW_IMG_HEIGHT = env.int(\"PREVIEW_IMG_HEIGHT\", 630)\nPREVIEW_DEFAULT_COVER_COLOR = env.str(\"PREVIEW_DEFAULT_COVER_COLOR\", \"#002549\")\n\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = env(\"SECRET_KEY\")\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = env.bool(\"DEBUG\", True)\nUSE_HTTPS = env.bool(\"USE_HTTPS\", False)\n\nALLOWED_HOSTS = env.list(\"ALLOWED_HOSTS\", [\"*\"])\n\n# Application definition\n\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \"django.contrib.humanize\",\n    \"django_rename_app\",\n    \"bookwyrm\",\n    \"celery\",\n    \"imagekit\",\n    \"storages\",\n]\n\nMIDDLEWARE = [\n    \"django.middleware.security.SecurityMiddleware\",\n    \"django.contrib.sessions.middleware.SessionMiddleware\",\n    \"django.middleware.locale.LocaleMiddleware\",\n    \"django.middleware.common.CommonMiddleware\",\n    \"django.middleware.csrf.CsrfViewMiddleware\",\n    \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n    \"bookwyrm.timezone_middleware.TimezoneMiddleware\",\n    \"django.contrib.messages.middleware.MessageMiddleware\",\n    \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n]\n\nROOT_URLCONF = \"bookwyrm.urls\"\n\nTEMPLATES = [\n    {\n        \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n        \"DIRS\": [\"templates\"],\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                \"bookwyrm.context_processors.site_settings\",\n            ],\n        },\n    },\n]\n\n\nWSGI_APPLICATION = \"bookwyrm.wsgi.application\"\n\n# redis/activity streams settings\nREDIS_ACTIVITY_HOST = env(\"REDIS_ACTIVITY_HOST\", \"localhost\")\nREDIS_ACTIVITY_PORT = env(\"REDIS_ACTIVITY_PORT\", 6379)\nREDIS_ACTIVITY_PASSWORD = env(\"REDIS_ACTIVITY_PASSWORD\", None)\n\nMAX_STREAM_LENGTH = int(env(\"MAX_STREAM_LENGTH\", 200))\n\nSTREAMS = [\n    {\"key\": \"home\", \"name\": _(\"Home Timeline\"), \"shortname\": _(\"Home\")},\n    {\"key\": \"books\", \"name\": _(\"Books Timeline\"), \"shortname\": _(\"Books\")},\n]\n\n# Database\n# https://docs.djangoproject.com/en/3.2/ref/settings/#databases\n\nDATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.db.backends.postgresql_psycopg2\",\n        \"NAME\": env(\"POSTGRES_DB\", \"fedireads\"),\n        \"USER\": env(\"POSTGRES_USER\", \"fedireads\"),\n        \"PASSWORD\": env(\"POSTGRES_PASSWORD\", \"fedireads\"),\n        \"HOST\": env(\"POSTGRES_HOST\", \"\"),\n        \"PORT\": env(\"POSTGRES_PORT\", 5432),\n    },\n}\n\n\nLOGIN_URL = \"/login/\"\nAUTH_USER_MODEL = \"bookwyrm.User\"\n\n# Password validation\n# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators\n\n# pylint: disable=line-too-long\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\",\n    },\n]\n\n\n# Internationalization\n# https://docs.djangoproject.com/en/3.2/topics/i18n/\n\nLANGUAGE_CODE = \"en-us\"\nLANGUAGES = [\n    (\"en-us\", _(\"English\")),\n    (\"de-de\", _(\"German\")),\n    (\"es\", _(\"Spanish\")),\n    (\"fr-fr\", _(\"French\")),\n    (\"zh-hans\", _(\"Simplified Chinese\")),\n    (\"zh-hant\", _(\"Traditional Chinese\")),\n]\n\n\nTIME_ZONE = \"UTC\"\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n\nUSER_AGENT = \"%s (BookWyrm/%s; +https://%s/)\" % (\n    requests.utils.default_user_agent(),\n    VERSION,\n    DOMAIN,\n)\n\n# Imagekit generated thumbnails\nENABLE_THUMBNAIL_GENERATION = env.bool(\"ENABLE_THUMBNAIL_GENERATION\", False)\nIMAGEKIT_CACHEFILE_DIR = \"thumbnails\"\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/3.2/howto/static-files/\n\nPROJECT_DIR = os.path.dirname(os.path.abspath(__file__))\n\n# Storage\n\nPROTOCOL = \"http\"\nif USE_HTTPS:\n    PROTOCOL = \"https\"\n\nUSE_S3 = env.bool(\"USE_S3\", False)\n\nif USE_S3:\n    # AWS settings\n    AWS_ACCESS_KEY_ID = env(\"AWS_ACCESS_KEY_ID\")\n    AWS_SECRET_ACCESS_KEY = env(\"AWS_SECRET_ACCESS_KEY\")\n    AWS_STORAGE_BUCKET_NAME = env(\"AWS_STORAGE_BUCKET_NAME\")\n    AWS_S3_CUSTOM_DOMAIN = env(\"AWS_S3_CUSTOM_DOMAIN\")\n    AWS_S3_REGION_NAME = env(\"AWS_S3_REGION_NAME\", \"\")\n    AWS_S3_ENDPOINT_URL = env(\"AWS_S3_ENDPOINT_URL\")\n    AWS_DEFAULT_ACL = \"public-read\"\n    AWS_S3_OBJECT_PARAMETERS = {\"CacheControl\": \"max-age=86400\"}\n    # S3 Static settings\n    STATIC_LOCATION = \"static\"\n    STATIC_URL = \"https://%s/%s/\" % (AWS_S3_CUSTOM_DOMAIN, STATIC_LOCATION)\n    STATICFILES_STORAGE = \"bookwyrm.storage_backends.StaticStorage\"\n    # S3 Media settings\n    MEDIA_LOCATION = \"images\"\n    MEDIA_URL = \"https://%s/%s/\" % (AWS_S3_CUSTOM_DOMAIN, MEDIA_LOCATION)\n    MEDIA_FULL_URL = MEDIA_URL\n    DEFAULT_FILE_STORAGE = \"bookwyrm.storage_backends.ImagesStorage\"\n    # I don't know if it's used, but the site crashes without it\n    STATIC_ROOT = os.path.join(BASE_DIR, env(\"STATIC_ROOT\", \"static\"))\n    MEDIA_ROOT = os.path.join(BASE_DIR, env(\"MEDIA_ROOT\", \"images\"))\nelse:\n    STATIC_URL = \"/static/\"\n    STATIC_ROOT = os.path.join(BASE_DIR, env(\"STATIC_ROOT\", \"static\"))\n    MEDIA_URL = \"/images/\"\n    MEDIA_FULL_URL = \"%s://%s%s\" % (PROTOCOL, DOMAIN, MEDIA_URL)\n    MEDIA_ROOT = os.path.join(BASE_DIR, env(\"MEDIA_ROOT\", \"images\"))\n", "path": "bookwyrm/settings.py"}]}