summaryrefslogtreecommitdiffstats
path: root/takahe
diff options
context:
space:
mode:
Diffstat (limited to 'takahe')
-rw-r--r--takahe/settings/base.py6
-rw-r--r--takahe/urls.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/takahe/settings/base.py b/takahe/settings/base.py
index b98b9a0..dd89818 100644
--- a/takahe/settings/base.py
+++ b/takahe/settings/base.py
@@ -108,5 +108,7 @@ STATICFILES_DIRS = [
ALLOWED_HOSTS = ["*"]
-MEDIA_ROOT = BASE_DIR / "media"
-MEDIA_URL = "/media/"
+
+# Note that this MUST be a fully qualified URL in production
+MEDIA_URL = os.environ.get("TAKAHE_MEDIA_URL", "/media/")
+MEDIA_ROOT = os.environ.get("TAKAHE_MEDIA_ROOT", BASE_DIR / "media")
diff --git a/takahe/urls.py b/takahe/urls.py
index c2d9d6b..0b23d7d 100644
--- a/takahe/urls.py
+++ b/takahe/urls.py
@@ -1,5 +1,3 @@
-import re
-
from django.conf import settings as djsettings
from django.contrib import admin as djadmin
from django.urls import path, re_path
@@ -99,7 +97,7 @@ urlpatterns = [
path("djadmin/", djadmin.site.urls),
# Media files
re_path(
- r"^%s(?P<path>.*)$" % re.escape(djsettings.MEDIA_URL.lstrip("/")),
+ r"^media/(?P<path>.*)$",
serve,
kwargs={"document_root": djsettings.MEDIA_ROOT},
),