From 972ee3e4d4d470715352d6509fd60ee6dfc982a1 Mon Sep 17 00:00:00 2001 From: Dmitriy Andreev Date: Sun, 7 Feb 2021 15:02:08 +0300 Subject: [PATCH 1/2] Added base html --- access_controller/urls.py | 3 ++ main/templates/base/base.html | 55 +++++++++++++++++++++++++++++++++ main/templates/base/menu.html | 26 ++++++++++++++++ main/templates/pages/index.html | 17 ++++++++++ main/views.py | 4 ++- 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 main/templates/base/base.html create mode 100644 main/templates/base/menu.html create mode 100644 main/templates/pages/index.html diff --git a/access_controller/urls.py b/access_controller/urls.py index e0ecf63..bdd60eb 100644 --- a/access_controller/urls.py +++ b/access_controller/urls.py @@ -16,6 +16,9 @@ Including another URLconf from django.contrib import admin from django.urls import path +from main.views import main_page + urlpatterns = [ path('admin/', admin.site.urls), + path('', main_page), ] diff --git a/main/templates/base/base.html b/main/templates/base/base.html new file mode 100644 index 0000000..e41acf5 --- /dev/null +++ b/main/templates/base/base.html @@ -0,0 +1,55 @@ + + + + + + {% block title %}{% endblock %} + + + + {% block extra_css %}{% endblock %} + + +{% include 'base/menu.html' %} + +
+
+

+ {% block heading %} + {% endblock %} +

+ {% block content %} + {% endblock %} +
+
+ + + + + + diff --git a/main/templates/base/menu.html b/main/templates/base/menu.html new file mode 100644 index 0000000..ca31bd0 --- /dev/null +++ b/main/templates/base/menu.html @@ -0,0 +1,26 @@ +
+ + + + +
diff --git a/main/templates/pages/index.html b/main/templates/pages/index.html new file mode 100644 index 0000000..4dc9966 --- /dev/null +++ b/main/templates/pages/index.html @@ -0,0 +1,17 @@ +{% extends 'base/base.html' %} + +{% block title %} +Главная +{% endblock %} + +{% block content %} +
+
+ +

Добро пожаловать!

+

Мы рады приветствовать Вас на нашем сайте. Главная его задача - выдавать права пользователям системы по запросу самого + пользователя.

+
Сайт использует API ZenDesk.
+
+
+{% endblock %} diff --git a/main/views.py b/main/views.py index 91ea44a..a1eb178 100644 --- a/main/views.py +++ b/main/views.py @@ -1,3 +1,5 @@ from django.shortcuts import render -# Create your views here. + +def main_page(request): + return render(request, 'pages/index.html') From 298baa31981bbec9369a3880347fc8650f73485b Mon Sep 17 00:00:00 2001 From: Dmitriy Andreev Date: Wed, 10 Feb 2021 21:18:38 +0300 Subject: [PATCH 2/2] Added site logo --- access_controller/settings.py | 5 +++-- main/templates/base/base.html | 1 + main/templates/base/menu.html | 5 +++-- staticfiles/main/img/logo.png | Bin 0 -> 53835 bytes 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 staticfiles/main/img/logo.png diff --git a/access_controller/settings.py b/access_controller/settings.py index dc44189..caf4521 100644 --- a/access_controller/settings.py +++ b/access_controller/settings.py @@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ - +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -121,8 +121,9 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = [ - 'static' + os.path.join(BASE_DIR, 'staticfiles'), ] MEDIA_ROOT = BASE_DIR / 'media' diff --git a/main/templates/base/base.html b/main/templates/base/base.html index e41acf5..071c914 100644 --- a/main/templates/base/base.html +++ b/main/templates/base/base.html @@ -1,5 +1,6 @@ +{% load static %} diff --git a/main/templates/base/menu.html b/main/templates/base/menu.html index ca31bd0..4aabc46 100644 --- a/main/templates/base/menu.html +++ b/main/templates/base/menu.html @@ -1,10 +1,11 @@ +{% load static %}
-