From f5eafb0ca0af3ed064202abbe99bfbeef8bbb74d Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 17 Nov 2022 08:21:42 -0700 Subject: Add image/icon upload --- takahe/settings/base.py | 3 +++ takahe/urls.py | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'takahe') diff --git a/takahe/settings/base.py b/takahe/settings/base.py index e45133d..b98b9a0 100644 --- a/takahe/settings/base.py +++ b/takahe/settings/base.py @@ -107,3 +107,6 @@ STATICFILES_DIRS = [ ] ALLOWED_HOSTS = ["*"] + +MEDIA_ROOT = BASE_DIR / "media" +MEDIA_URL = "/media/" diff --git a/takahe/urls.py b/takahe/urls.py index 638dabd..5f5d5c5 100644 --- a/takahe/urls.py +++ b/takahe/urls.py @@ -1,5 +1,9 @@ +import re + +from django.conf import settings as djsettings from django.contrib import admin as djadmin -from django.urls import path +from django.urls import path, re_path +from django.views.static import serve from activities.views import posts, timelines from core import views as core @@ -18,6 +22,11 @@ urlpatterns = [ settings.SettingsRoot.as_view(), name="settings", ), + path( + "settings/profile/", + settings.ProfilePage.as_view(), + name="settings_profile", + ), path( "settings/interface/", settings.InterfacePage.as_view(), @@ -87,4 +96,10 @@ urlpatterns = [ path(".stator/runner/", stator.RequestRunner.as_view()), # Django admin path("djadmin/", djadmin.site.urls), + # Media files + re_path( + r"^%s(?P.*)$" % re.escape(djsettings.MEDIA_URL.lstrip("/")), + serve, + kwargs={"document_root": djsettings.MEDIA_ROOT}, + ), ] -- cgit v1.2.3