We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Allow changing what email notifications are sent from
**Is your feature request related to a problem? Please describe.**
It came up on the Matrix chat that an admin didn't have an admin@ email for their domain, and wanted to change it to no-reply@, which is only possible by changing `settings.py`

**Describe the solution you'd like**
It would be nice to be able to configure this in the `.env` alongside the rest of the email things - perhaps `EMAIL_FROM_ADDRESS` or `EMAIL_SENDER_ADDRESS` or something.

**Describe alternatives you've considered**
Changing in settings.py works but is in a checked-in file so that's not great. We could allow just changing the username of the email, but it seems useful to have the additional flexibility (for example, I might want to send my Bookywrm emails from `bookwyrm@cincodenada.com` instead of `admin@bookwyrm.cincodenada.com`, since I can't receive email at `bookwyrm.cincodenada.com`)

**Additional context**
[Matrix conversation](https://matrix.to/#/!zoxBMxLlvIyeEKkHuB:matrix.org/$tQg0cS2vzhBeziDszNLxnIc21TR-KzYk55PgWBpyRTo?via=matrix.org&via=tchncs.de&via=group.lt)


--- 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/emailing.py`
Content:
```
1 """ send emails """
2 from django.core.mail import EmailMultiAlternatives
3 from django.template.loader import get_template
4 
5 from bookwyrm import models, settings
6 from bookwyrm.tasks import app
7 from bookwyrm.settings import DOMAIN
8 
9 
10 def email_data():
11     """fields every email needs"""
12     site = models.SiteSettings.objects.get()
13     return {
14         "site_name": site.name,
15         "logo": site.logo_small_url,
16         "domain": DOMAIN,
17         "user": None,
18     }
19 
20 
21 def email_confirmation_email(user):
22     """newly registered users confirm email address"""
23     data = email_data()
24     data["confirmation_code"] = user.confirmation_code
25     data["confirmation_link"] = user.confirmation_link
26     send_email.delay(user.email, *format_email("confirm", data))
27 
28 
29 def invite_email(invite_request):
30     """send out an invite code"""
31     data = email_data()
32     data["invite_link"] = invite_request.invite.link
33     send_email.delay(invite_request.email, *format_email("invite", data))
34 
35 
36 def password_reset_email(reset_code):
37     """generate a password reset email"""
38     data = email_data()
39     data["reset_link"] = reset_code.link
40     data["user"] = reset_code.user.display_name
41     send_email.delay(reset_code.user.email, *format_email("password_reset", data))
42 
43 
44 def moderation_report_email(report):
45     """a report was created"""
46     data = email_data()
47     data["reporter"] = report.reporter.localname or report.reporter.username
48     data["reportee"] = report.user.localname or report.user.username
49     data["report_link"] = report.remote_id
50 
51     for admin in models.User.objects.filter(groups__name__in=["admin", "moderator"]):
52         data["user"] = admin.display_name
53         send_email.delay(admin.email, *format_email("moderation_report", data))
54 
55 
56 def format_email(email_name, data):
57     """render the email templates"""
58     subject = get_template(f"email/{email_name}/subject.html").render(data).strip()
59     html_content = (
60         get_template(f"email/{email_name}/html_content.html").render(data).strip()
61     )
62     text_content = (
63         get_template(f"email/{email_name}/text_content.html").render(data).strip()
64     )
65     return (subject, html_content, text_content)
66 
67 
68 @app.task(queue="high_priority")
69 def send_email(recipient, subject, html_content, text_content):
70     """use a task to send the email"""
71     email = EmailMultiAlternatives(
72         subject, text_content, settings.DEFAULT_FROM_EMAIL, [recipient]
73     )
74     email.attach_alternative(html_content, "text/html")
75     email.send()
76
```

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 env.read_env()
11 DOMAIN = env("DOMAIN")
12 VERSION = "0.1.0"
13 
14 PAGE_LENGTH = env("PAGE_LENGTH", 15)
15 DEFAULT_LANGUAGE = env("DEFAULT_LANGUAGE", "English")
16 
17 JS_CACHE = "2d3181e1"
18 
19 # email
20 EMAIL_BACKEND = env("EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend")
21 EMAIL_HOST = env("EMAIL_HOST")
22 EMAIL_PORT = env("EMAIL_PORT", 587)
23 EMAIL_HOST_USER = env("EMAIL_HOST_USER")
24 EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
25 EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", True)
26 EMAIL_USE_SSL = env.bool("EMAIL_USE_SSL", False)
27 DEFAULT_FROM_EMAIL = f"admin@{DOMAIN}"
28 
29 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
30 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
31 LOCALE_PATHS = [
32     os.path.join(BASE_DIR, "locale"),
33 ]
34 LANGUAGE_COOKIE_NAME = env.str("LANGUAGE_COOKIE_NAME", "django_language")
35 
36 DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
37 
38 # Preview image
39 ENABLE_PREVIEW_IMAGES = env.bool("ENABLE_PREVIEW_IMAGES", False)
40 PREVIEW_BG_COLOR = env.str("PREVIEW_BG_COLOR", "use_dominant_color_light")
41 PREVIEW_TEXT_COLOR = env.str("PREVIEW_TEXT_COLOR", "#363636")
42 PREVIEW_IMG_WIDTH = env.int("PREVIEW_IMG_WIDTH", 1200)
43 PREVIEW_IMG_HEIGHT = env.int("PREVIEW_IMG_HEIGHT", 630)
44 PREVIEW_DEFAULT_COVER_COLOR = env.str("PREVIEW_DEFAULT_COVER_COLOR", "#002549")
45 
46 # Quick-start development settings - unsuitable for production
47 # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
48 
49 # SECURITY WARNING: keep the secret key used in production secret!
50 SECRET_KEY = env("SECRET_KEY")
51 
52 # SECURITY WARNING: don't run with debug turned on in production!
53 DEBUG = env.bool("DEBUG", True)
54 USE_HTTPS = env.bool("USE_HTTPS", False)
55 
56 ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", ["*"])
57 
58 # Application definition
59 
60 INSTALLED_APPS = [
61     "django.contrib.admin",
62     "django.contrib.auth",
63     "django.contrib.contenttypes",
64     "django.contrib.sessions",
65     "django.contrib.messages",
66     "django.contrib.staticfiles",
67     "django.contrib.humanize",
68     "django_rename_app",
69     "bookwyrm",
70     "celery",
71     "imagekit",
72     "storages",
73 ]
74 
75 MIDDLEWARE = [
76     "django.middleware.security.SecurityMiddleware",
77     "django.contrib.sessions.middleware.SessionMiddleware",
78     "django.middleware.locale.LocaleMiddleware",
79     "django.middleware.common.CommonMiddleware",
80     "django.middleware.csrf.CsrfViewMiddleware",
81     "django.contrib.auth.middleware.AuthenticationMiddleware",
82     "bookwyrm.middleware.TimezoneMiddleware",
83     "bookwyrm.middleware.IPBlocklistMiddleware",
84     "django.contrib.messages.middleware.MessageMiddleware",
85     "django.middleware.clickjacking.XFrameOptionsMiddleware",
86 ]
87 
88 ROOT_URLCONF = "bookwyrm.urls"
89 
90 TEMPLATES = [
91     {
92         "BACKEND": "django.template.backends.django.DjangoTemplates",
93         "DIRS": ["templates"],
94         "APP_DIRS": True,
95         "OPTIONS": {
96             "context_processors": [
97                 "django.template.context_processors.debug",
98                 "django.template.context_processors.request",
99                 "django.contrib.auth.context_processors.auth",
100                 "django.contrib.messages.context_processors.messages",
101                 "bookwyrm.context_processors.site_settings",
102             ],
103         },
104     },
105 ]
106 
107 
108 WSGI_APPLICATION = "bookwyrm.wsgi.application"
109 
110 # redis/activity streams settings
111 REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost")
112 REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379)
113 REDIS_ACTIVITY_PASSWORD = env("REDIS_ACTIVITY_PASSWORD", None)
114 
115 MAX_STREAM_LENGTH = int(env("MAX_STREAM_LENGTH", 200))
116 
117 STREAMS = [
118     {"key": "home", "name": _("Home Timeline"), "shortname": _("Home")},
119     {"key": "books", "name": _("Books Timeline"), "shortname": _("Books")},
120 ]
121 
122 # Search configuration
123 # total time in seconds that the instance will spend searching connectors
124 SEARCH_TIMEOUT = int(env("SEARCH_TIMEOUT", 15))
125 # timeout for a query to an individual connector
126 QUERY_TIMEOUT = int(env("QUERY_TIMEOUT", 5))
127 
128 # Redis cache backend
129 if env("USE_DUMMY_CACHE", False):
130     CACHES = {
131         "default": {
132             "BACKEND": "django.core.cache.backends.dummy.DummyCache",
133         }
134     }
135 else:
136     # pylint: disable=line-too-long
137     CACHES = {
138         "default": {
139             "BACKEND": "django_redis.cache.RedisCache",
140             "LOCATION": f"redis://:{REDIS_ACTIVITY_PASSWORD}@{REDIS_ACTIVITY_HOST}:{REDIS_ACTIVITY_PORT}/0",
141             "OPTIONS": {
142                 "CLIENT_CLASS": "django_redis.client.DefaultClient",
143             },
144         }
145     }
146 
147     SESSION_ENGINE = "django.contrib.sessions.backends.cache"
148     SESSION_CACHE_ALIAS = "default"
149 
150 # Database
151 # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
152 
153 DATABASES = {
154     "default": {
155         "ENGINE": "django.db.backends.postgresql_psycopg2",
156         "NAME": env("POSTGRES_DB", "bookwyrm"),
157         "USER": env("POSTGRES_USER", "bookwyrm"),
158         "PASSWORD": env("POSTGRES_PASSWORD", "bookwyrm"),
159         "HOST": env("POSTGRES_HOST", ""),
160         "PORT": env("PGPORT", 5432),
161     },
162 }
163 
164 
165 LOGIN_URL = "/login/"
166 AUTH_USER_MODEL = "bookwyrm.User"
167 
168 # Password validation
169 # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
170 
171 # pylint: disable=line-too-long
172 AUTH_PASSWORD_VALIDATORS = [
173     {
174         "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
175     },
176     {
177         "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
178     },
179     {
180         "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
181     },
182     {
183         "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
184     },
185 ]
186 
187 
188 # Internationalization
189 # https://docs.djangoproject.com/en/3.2/topics/i18n/
190 
191 LANGUAGE_CODE = "en-us"
192 LANGUAGES = [
193     ("en-us", _("English")),
194     ("de-de", _("Deutsch (German)")),
195     ("es-es", _("Español (Spanish)")),
196     ("gl-es", _("Galego (Galician)")),
197     ("fr-fr", _("Français (French)")),
198     ("lt-lt", _("Lietuvių (Lithuanian)")),
199     ("pt-br", _("Português do Brasil (Brazilian Portuguese)")),
200     ("pt-pt", _("Português Europeu (European Portuguese)")),
201     ("zh-hans", _("简体中文 (Simplified Chinese)")),
202     ("zh-hant", _("繁體中文 (Traditional Chinese)")),
203 ]
204 
205 
206 TIME_ZONE = "UTC"
207 
208 USE_I18N = True
209 
210 USE_L10N = True
211 
212 USE_TZ = True
213 
214 
215 agent = requests.utils.default_user_agent()
216 USER_AGENT = f"{agent} (BookWyrm/{VERSION}; +https://{DOMAIN}/)"
217 
218 # Imagekit generated thumbnails
219 ENABLE_THUMBNAIL_GENERATION = env.bool("ENABLE_THUMBNAIL_GENERATION", False)
220 IMAGEKIT_CACHEFILE_DIR = "thumbnails"
221 
222 # Static files (CSS, JavaScript, Images)
223 # https://docs.djangoproject.com/en/3.2/howto/static-files/
224 
225 PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
226 
227 # Storage
228 
229 PROTOCOL = "http"
230 if USE_HTTPS:
231     PROTOCOL = "https"
232 
233 USE_S3 = env.bool("USE_S3", False)
234 
235 if USE_S3:
236     # AWS settings
237     AWS_ACCESS_KEY_ID = env("AWS_ACCESS_KEY_ID")
238     AWS_SECRET_ACCESS_KEY = env("AWS_SECRET_ACCESS_KEY")
239     AWS_STORAGE_BUCKET_NAME = env("AWS_STORAGE_BUCKET_NAME")
240     AWS_S3_CUSTOM_DOMAIN = env("AWS_S3_CUSTOM_DOMAIN")
241     AWS_S3_REGION_NAME = env("AWS_S3_REGION_NAME", "")
242     AWS_S3_ENDPOINT_URL = env("AWS_S3_ENDPOINT_URL")
243     AWS_DEFAULT_ACL = "public-read"
244     AWS_S3_OBJECT_PARAMETERS = {"CacheControl": "max-age=86400"}
245     # S3 Static settings
246     STATIC_LOCATION = "static"
247     STATIC_URL = f"{PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/"
248     STATICFILES_STORAGE = "bookwyrm.storage_backends.StaticStorage"
249     # S3 Media settings
250     MEDIA_LOCATION = "images"
251     MEDIA_URL = f"{PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{MEDIA_LOCATION}/"
252     MEDIA_FULL_URL = MEDIA_URL
253     STATIC_FULL_URL = STATIC_URL
254     DEFAULT_FILE_STORAGE = "bookwyrm.storage_backends.ImagesStorage"
255     # I don't know if it's used, but the site crashes without it
256     STATIC_ROOT = os.path.join(BASE_DIR, env("STATIC_ROOT", "static"))
257     MEDIA_ROOT = os.path.join(BASE_DIR, env("MEDIA_ROOT", "images"))
258 else:
259     STATIC_URL = "/static/"
260     STATIC_ROOT = os.path.join(BASE_DIR, env("STATIC_ROOT", "static"))
261     MEDIA_URL = "/images/"
262     MEDIA_FULL_URL = f"{PROTOCOL}://{DOMAIN}{MEDIA_URL}"
263     STATIC_FULL_URL = f"{PROTOCOL}://{DOMAIN}{STATIC_URL}"
264     MEDIA_ROOT = os.path.join(BASE_DIR, env("MEDIA_ROOT", "images"))
265
```
--- 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/emailing.py b/bookwyrm/emailing.py
--- a/bookwyrm/emailing.py
+++ b/bookwyrm/emailing.py
@@ -69,7 +69,7 @@
 def send_email(recipient, subject, html_content, text_content):
     """use a task to send the email"""
     email = EmailMultiAlternatives(
-        subject, text_content, settings.DEFAULT_FROM_EMAIL, [recipient]
+        subject, text_content, settings.EMAIL_SENDER, [recipient]
     )
     email.attach_alternative(html_content, "text/html")
     email.send()
diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py
--- a/bookwyrm/settings.py
+++ b/bookwyrm/settings.py
@@ -24,7 +24,9 @@
 EMAIL_HOST_PASSWORD = env("EMAIL_HOST_PASSWORD")
 EMAIL_USE_TLS = env.bool("EMAIL_USE_TLS", True)
 EMAIL_USE_SSL = env.bool("EMAIL_USE_SSL", False)
-DEFAULT_FROM_EMAIL = f"admin@{DOMAIN}"
+EMAIL_SENDER_NAME = env("EMAIL_SENDER_NAME", "admin")
+EMAIL_SENDER_DOMAIN = env("EMAIL_SENDER_NAME", DOMAIN)
+EMAIL_SENDER = f"{EMAIL_SENDER_NAME}@{EMAIL_SENDER_DOMAIN}"
 
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

{"golden_diff": "diff --git a/bookwyrm/emailing.py b/bookwyrm/emailing.py\n--- a/bookwyrm/emailing.py\n+++ b/bookwyrm/emailing.py\n@@ -69,7 +69,7 @@\n def send_email(recipient, subject, html_content, text_content):\n     \"\"\"use a task to send the email\"\"\"\n     email = EmailMultiAlternatives(\n-        subject, text_content, settings.DEFAULT_FROM_EMAIL, [recipient]\n+        subject, text_content, settings.EMAIL_SENDER, [recipient]\n     )\n     email.attach_alternative(html_content, \"text/html\")\n     email.send()\ndiff --git a/bookwyrm/settings.py b/bookwyrm/settings.py\n--- a/bookwyrm/settings.py\n+++ b/bookwyrm/settings.py\n@@ -24,7 +24,9 @@\n EMAIL_HOST_PASSWORD = env(\"EMAIL_HOST_PASSWORD\")\n EMAIL_USE_TLS = env.bool(\"EMAIL_USE_TLS\", True)\n EMAIL_USE_SSL = env.bool(\"EMAIL_USE_SSL\", False)\n-DEFAULT_FROM_EMAIL = f\"admin@{DOMAIN}\"\n+EMAIL_SENDER_NAME = env(\"EMAIL_SENDER_NAME\", \"admin\")\n+EMAIL_SENDER_DOMAIN = env(\"EMAIL_SENDER_NAME\", DOMAIN)\n+EMAIL_SENDER = f\"{EMAIL_SENDER_NAME}@{EMAIL_SENDER_DOMAIN}\"\n \n # Build paths inside the project like this: os.path.join(BASE_DIR, ...)\n BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n", "issue": "Allow changing what email notifications are sent from\n**Is your feature request related to a problem? Please describe.**\r\nIt came up on the Matrix chat that an admin didn't have an admin@ email for their domain, and wanted to change it to no-reply@, which is only possible by changing `settings.py`\r\n\r\n**Describe the solution you'd like**\r\nIt would be nice to be able to configure this in the `.env` alongside the rest of the email things - perhaps `EMAIL_FROM_ADDRESS` or `EMAIL_SENDER_ADDRESS` or something.\r\n\r\n**Describe alternatives you've considered**\r\nChanging in settings.py works but is in a checked-in file so that's not great. We could allow just changing the username of the email, but it seems useful to have the additional flexibility (for example, I might want to send my Bookywrm emails from `bookwyrm@cincodenada.com` instead of `admin@bookwyrm.cincodenada.com`, since I can't receive email at `bookwyrm.cincodenada.com`)\r\n\r\n**Additional context**\r\n[Matrix conversation](https://matrix.to/#/!zoxBMxLlvIyeEKkHuB:matrix.org/$tQg0cS2vzhBeziDszNLxnIc21TR-KzYk55PgWBpyRTo?via=matrix.org&via=tchncs.de&via=group.lt)\r\n\n", "before_files": [{"content": "\"\"\" send emails \"\"\"\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import get_template\n\nfrom bookwyrm import models, settings\nfrom bookwyrm.tasks import app\nfrom bookwyrm.settings import DOMAIN\n\n\ndef email_data():\n    \"\"\"fields every email needs\"\"\"\n    site = models.SiteSettings.objects.get()\n    return {\n        \"site_name\": site.name,\n        \"logo\": site.logo_small_url,\n        \"domain\": DOMAIN,\n        \"user\": None,\n    }\n\n\ndef email_confirmation_email(user):\n    \"\"\"newly registered users confirm email address\"\"\"\n    data = email_data()\n    data[\"confirmation_code\"] = user.confirmation_code\n    data[\"confirmation_link\"] = user.confirmation_link\n    send_email.delay(user.email, *format_email(\"confirm\", data))\n\n\ndef invite_email(invite_request):\n    \"\"\"send out an invite code\"\"\"\n    data = email_data()\n    data[\"invite_link\"] = invite_request.invite.link\n    send_email.delay(invite_request.email, *format_email(\"invite\", data))\n\n\ndef password_reset_email(reset_code):\n    \"\"\"generate a password reset email\"\"\"\n    data = email_data()\n    data[\"reset_link\"] = reset_code.link\n    data[\"user\"] = reset_code.user.display_name\n    send_email.delay(reset_code.user.email, *format_email(\"password_reset\", data))\n\n\ndef moderation_report_email(report):\n    \"\"\"a report was created\"\"\"\n    data = email_data()\n    data[\"reporter\"] = report.reporter.localname or report.reporter.username\n    data[\"reportee\"] = report.user.localname or report.user.username\n    data[\"report_link\"] = report.remote_id\n\n    for admin in models.User.objects.filter(groups__name__in=[\"admin\", \"moderator\"]):\n        data[\"user\"] = admin.display_name\n        send_email.delay(admin.email, *format_email(\"moderation_report\", data))\n\n\ndef format_email(email_name, data):\n    \"\"\"render the email templates\"\"\"\n    subject = get_template(f\"email/{email_name}/subject.html\").render(data).strip()\n    html_content = (\n        get_template(f\"email/{email_name}/html_content.html\").render(data).strip()\n    )\n    text_content = (\n        get_template(f\"email/{email_name}/text_content.html\").render(data).strip()\n    )\n    return (subject, html_content, text_content)\n\n\n@app.task(queue=\"high_priority\")\ndef send_email(recipient, subject, html_content, text_content):\n    \"\"\"use a task to send the email\"\"\"\n    email = EmailMultiAlternatives(\n        subject, text_content, settings.DEFAULT_FROM_EMAIL, [recipient]\n    )\n    email.attach_alternative(html_content, \"text/html\")\n    email.send()\n", "path": "bookwyrm/emailing.py"}, {"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()\nenv.read_env()\nDOMAIN = env(\"DOMAIN\")\nVERSION = \"0.1.0\"\n\nPAGE_LENGTH = env(\"PAGE_LENGTH\", 15)\nDEFAULT_LANGUAGE = env(\"DEFAULT_LANGUAGE\", \"English\")\n\nJS_CACHE = \"2d3181e1\"\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 = f\"admin@{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]\nLANGUAGE_COOKIE_NAME = env.str(\"LANGUAGE_COOKIE_NAME\", \"django_language\")\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.middleware.TimezoneMiddleware\",\n    \"bookwyrm.middleware.IPBlocklistMiddleware\",\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# Search configuration\n# total time in seconds that the instance will spend searching connectors\nSEARCH_TIMEOUT = int(env(\"SEARCH_TIMEOUT\", 15))\n# timeout for a query to an individual connector\nQUERY_TIMEOUT = int(env(\"QUERY_TIMEOUT\", 5))\n\n# Redis cache backend\nif env(\"USE_DUMMY_CACHE\", False):\n    CACHES = {\n        \"default\": {\n            \"BACKEND\": \"django.core.cache.backends.dummy.DummyCache\",\n        }\n    }\nelse:\n    # pylint: disable=line-too-long\n    CACHES = {\n        \"default\": {\n            \"BACKEND\": \"django_redis.cache.RedisCache\",\n            \"LOCATION\": f\"redis://:{REDIS_ACTIVITY_PASSWORD}@{REDIS_ACTIVITY_HOST}:{REDIS_ACTIVITY_PORT}/0\",\n            \"OPTIONS\": {\n                \"CLIENT_CLASS\": \"django_redis.client.DefaultClient\",\n            },\n        }\n    }\n\n    SESSION_ENGINE = \"django.contrib.sessions.backends.cache\"\n    SESSION_CACHE_ALIAS = \"default\"\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\", \"bookwyrm\"),\n        \"USER\": env(\"POSTGRES_USER\", \"bookwyrm\"),\n        \"PASSWORD\": env(\"POSTGRES_PASSWORD\", \"bookwyrm\"),\n        \"HOST\": env(\"POSTGRES_HOST\", \"\"),\n        \"PORT\": env(\"PGPORT\", 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\", _(\"Deutsch (German)\")),\n    (\"es-es\", _(\"Espa\u00f1ol (Spanish)\")),\n    (\"gl-es\", _(\"Galego (Galician)\")),\n    (\"fr-fr\", _(\"Fran\u00e7ais (French)\")),\n    (\"lt-lt\", _(\"Lietuvi\u0173 (Lithuanian)\")),\n    (\"pt-br\", _(\"Portugu\u00eas do Brasil (Brazilian Portuguese)\")),\n    (\"pt-pt\", _(\"Portugu\u00eas Europeu (European Portuguese)\")),\n    (\"zh-hans\", _(\"\u7b80\u4f53\u4e2d\u6587 (Simplified Chinese)\")),\n    (\"zh-hant\", _(\"\u7e41\u9ad4\u4e2d\u6587 (Traditional Chinese)\")),\n]\n\n\nTIME_ZONE = \"UTC\"\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n\nagent = requests.utils.default_user_agent()\nUSER_AGENT = f\"{agent} (BookWyrm/{VERSION}; +https://{DOMAIN}/)\"\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 = f\"{PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/\"\n    STATICFILES_STORAGE = \"bookwyrm.storage_backends.StaticStorage\"\n    # S3 Media settings\n    MEDIA_LOCATION = \"images\"\n    MEDIA_URL = f\"{PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{MEDIA_LOCATION}/\"\n    MEDIA_FULL_URL = MEDIA_URL\n    STATIC_FULL_URL = STATIC_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 = f\"{PROTOCOL}://{DOMAIN}{MEDIA_URL}\"\n    STATIC_FULL_URL = f\"{PROTOCOL}://{DOMAIN}{STATIC_URL}\"\n    MEDIA_ROOT = os.path.join(BASE_DIR, env(\"MEDIA_ROOT\", \"images\"))\n", "path": "bookwyrm/settings.py"}], "after_files": [{"content": "\"\"\" send emails \"\"\"\nfrom django.core.mail import EmailMultiAlternatives\nfrom django.template.loader import get_template\n\nfrom bookwyrm import models, settings\nfrom bookwyrm.tasks import app\nfrom bookwyrm.settings import DOMAIN\n\n\ndef email_data():\n    \"\"\"fields every email needs\"\"\"\n    site = models.SiteSettings.objects.get()\n    return {\n        \"site_name\": site.name,\n        \"logo\": site.logo_small_url,\n        \"domain\": DOMAIN,\n        \"user\": None,\n    }\n\n\ndef email_confirmation_email(user):\n    \"\"\"newly registered users confirm email address\"\"\"\n    data = email_data()\n    data[\"confirmation_code\"] = user.confirmation_code\n    data[\"confirmation_link\"] = user.confirmation_link\n    send_email.delay(user.email, *format_email(\"confirm\", data))\n\n\ndef invite_email(invite_request):\n    \"\"\"send out an invite code\"\"\"\n    data = email_data()\n    data[\"invite_link\"] = invite_request.invite.link\n    send_email.delay(invite_request.email, *format_email(\"invite\", data))\n\n\ndef password_reset_email(reset_code):\n    \"\"\"generate a password reset email\"\"\"\n    data = email_data()\n    data[\"reset_link\"] = reset_code.link\n    data[\"user\"] = reset_code.user.display_name\n    send_email.delay(reset_code.user.email, *format_email(\"password_reset\", data))\n\n\ndef moderation_report_email(report):\n    \"\"\"a report was created\"\"\"\n    data = email_data()\n    data[\"reporter\"] = report.reporter.localname or report.reporter.username\n    data[\"reportee\"] = report.user.localname or report.user.username\n    data[\"report_link\"] = report.remote_id\n\n    for admin in models.User.objects.filter(groups__name__in=[\"admin\", \"moderator\"]):\n        data[\"user\"] = admin.display_name\n        send_email.delay(admin.email, *format_email(\"moderation_report\", data))\n\n\ndef format_email(email_name, data):\n    \"\"\"render the email templates\"\"\"\n    subject = get_template(f\"email/{email_name}/subject.html\").render(data).strip()\n    html_content = (\n        get_template(f\"email/{email_name}/html_content.html\").render(data).strip()\n    )\n    text_content = (\n        get_template(f\"email/{email_name}/text_content.html\").render(data).strip()\n    )\n    return (subject, html_content, text_content)\n\n\n@app.task(queue=\"high_priority\")\ndef send_email(recipient, subject, html_content, text_content):\n    \"\"\"use a task to send the email\"\"\"\n    email = EmailMultiAlternatives(\n        subject, text_content, settings.EMAIL_SENDER, [recipient]\n    )\n    email.attach_alternative(html_content, \"text/html\")\n    email.send()\n", "path": "bookwyrm/emailing.py"}, {"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()\nenv.read_env()\nDOMAIN = env(\"DOMAIN\")\nVERSION = \"0.1.0\"\n\nPAGE_LENGTH = env(\"PAGE_LENGTH\", 15)\nDEFAULT_LANGUAGE = env(\"DEFAULT_LANGUAGE\", \"English\")\n\nJS_CACHE = \"2d3181e1\"\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)\nEMAIL_SENDER_NAME = env(\"EMAIL_SENDER_NAME\", \"admin\")\nEMAIL_SENDER_DOMAIN = env(\"EMAIL_SENDER_NAME\", DOMAIN)\nEMAIL_SENDER = f\"{EMAIL_SENDER_NAME}@{EMAIL_SENDER_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]\nLANGUAGE_COOKIE_NAME = env.str(\"LANGUAGE_COOKIE_NAME\", \"django_language\")\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.middleware.TimezoneMiddleware\",\n    \"bookwyrm.middleware.IPBlocklistMiddleware\",\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\", \"bookwyrm\"),\n        \"USER\": env(\"POSTGRES_USER\", \"bookwyrm\"),\n        \"PASSWORD\": env(\"POSTGRES_PASSWORD\", \"bookwyrm\"),\n        \"HOST\": env(\"POSTGRES_HOST\", \"\"),\n        \"PORT\": env(\"PGPORT\", 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\", _(\"Deutsch (German)\")),\n    (\"es-es\", _(\"Espa\u00f1ol (Spanish)\")),\n    (\"gl-es\", _(\"Galego (Galician)\")),\n    (\"fr-fr\", _(\"Fran\u00e7ais (French)\")),\n    (\"lt-lt\", _(\"Lietuvi\u0173 (Lithuanian)\")),\n    (\"pt-br\", _(\"Portugu\u00eas do Brasil (Brazilian Portuguese)\")),\n    (\"pt-pt\", _(\"Portugu\u00eas Europeu (European Portuguese)\")),\n    (\"zh-hans\", _(\"\u7b80\u4f53\u4e2d\u6587 (Simplified Chinese)\")),\n    (\"zh-hant\", _(\"\u7e41\u9ad4\u4e2d\u6587 (Traditional Chinese)\")),\n]\n\n\nTIME_ZONE = \"UTC\"\n\nUSE_I18N = True\n\nUSE_L10N = True\n\nUSE_TZ = True\n\n\nagent = requests.utils.default_user_agent()\nUSER_AGENT = f\"{agent} (BookWyrm/{VERSION}; +https://{DOMAIN}/)\"\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 = f\"{PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/\"\n    STATICFILES_STORAGE = \"bookwyrm.storage_backends.StaticStorage\"\n    # S3 Media settings\n    MEDIA_LOCATION = \"images\"\n    MEDIA_URL = f\"{PROTOCOL}://{AWS_S3_CUSTOM_DOMAIN}/{MEDIA_LOCATION}/\"\n    MEDIA_FULL_URL = MEDIA_URL\n    STATIC_FULL_URL = STATIC_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 = f\"{PROTOCOL}://{DOMAIN}{MEDIA_URL}\"\n    STATIC_FULL_URL = f\"{PROTOCOL}://{DOMAIN}{STATIC_URL}\"\n    MEDIA_ROOT = os.path.join(BASE_DIR, env(\"MEDIA_ROOT\", \"images\"))\n", "path": "bookwyrm/settings.py"}]}