From d91f5b8ba832288220d9a823053cb1c2f716f4b6 Mon Sep 17 00:00:00 2001 From: Sokurov Idar Date: Thu, 11 Feb 2021 21:26:02 +0300 Subject: [PATCH] Add media to staticfiles, update `profile.html` --- access_controller/settings.py | 2 +- access_controller/urls.py | 3 -- main/templates/pages/profile.html | 51 +++++++++++++++++-------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/access_controller/settings.py b/access_controller/settings.py index 6d913ab..eecfa19 100644 --- a/access_controller/settings.py +++ b/access_controller/settings.py @@ -119,6 +119,7 @@ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticroot') STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), + os.path.join(BASE_DIR, 'media'), ] MEDIA_ROOT = BASE_DIR / 'media' @@ -126,4 +127,3 @@ MEDIA_URL = '/media/' LOGIN_REDIRECT_URL = '/' LOGOUT_REDIRECT_URL = '/' - diff --git a/access_controller/urls.py b/access_controller/urls.py index 6504a02..b2603b2 100644 --- a/access_controller/urls.py +++ b/access_controller/urls.py @@ -31,6 +31,3 @@ urlpatterns = [ path('accounts/', include('django.contrib.auth.urls')), path('accounts/', include('django_registration.backends.one_step.urls')), ] - -if DEBUG: - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/main/templates/pages/profile.html b/main/templates/pages/profile.html index 0b855b4..2b917eb 100644 --- a/main/templates/pages/profile.html +++ b/main/templates/pages/profile.html @@ -10,37 +10,42 @@ {% block extra_css %} - + + + + {% endblock %} {% block content %} -
-
-
-
- {% if image_name %} - Аватар - {% else %} - Нет изображения - {% endif %} -
-
-
-
-

Имя пользователя {{name}}

-

Электронная почта {{email}}

-

Текущая роль {{role}}

-
- -
-
+
+
+
+
+ {% if image_name %} + Аватар + {% else %} + Нет изображения + {% endif %}
+
+
Имя пользователя {{name}}
+
+
Электронная почта {{email}}
+
+
Текущая роль {{role}}
+
+
+
+
+ +
+
{% endblock %}