From 059f9e6d115e6becb767b00796825c0a89327e85 Mon Sep 17 00:00:00 2001 From: Lennart Heimbs Date: Tue, 5 Nov 2019 12:56:51 +0100 Subject: [PATCH] Praktikum Version 4 --- news/news/settings.py | 8 +++++--- news/news/urls.py | 1 + news/posts/urls.py | 2 +- news/posts/views.py | 3 ++- news/templates/base.html | 15 +++++++++++++++ news/templates/navbar.html | 19 +++++++++++++++++++ news/templates/posts/index.html | 12 ++++++++++++ 7 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 news/templates/base.html create mode 100644 news/templates/navbar.html create mode 100644 news/templates/posts/index.html diff --git a/news/news/settings.py b/news/news/settings.py index a642d39..951178c 100644 --- a/news/news/settings.py +++ b/news/news/settings.py @@ -54,7 +54,9 @@ ROOT_URLCONF = 'news.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [ + os.path.join(BASE_DIR, 'templates') + ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -103,9 +105,9 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'de-de' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Berlin' USE_I18N = True diff --git a/news/news/urls.py b/news/news/urls.py index a72b585..fc29896 100644 --- a/news/news/urls.py +++ b/news/news/urls.py @@ -17,6 +17,7 @@ from django.contrib import admin from django.urls import path, include urlpatterns = [ + path('', include('posts.urls')), path('posts/', include('posts.urls')), path('admin/', admin.site.urls), ] diff --git a/news/posts/urls.py b/news/posts/urls.py index 3c616ac..306c8bc 100644 --- a/news/posts/urls.py +++ b/news/posts/urls.py @@ -2,5 +2,5 @@ from django.urls import path from . import views urlpatterns = [ - path('', views.index, name='index',) + path('', views.index, name='index') ] \ No newline at end of file diff --git a/news/posts/views.py b/news/posts/views.py index 8b9d4ac..3a8276c 100644 --- a/news/posts/views.py +++ b/news/posts/views.py @@ -3,4 +3,5 @@ from django.http import HttpResponse # Create your views here. def index(request): - return HttpResponse("Posts Index") \ No newline at end of file + return render(request, 'posts/index.html') +#HttpResponse("Posts Index") \ No newline at end of file diff --git a/news/templates/base.html b/news/templates/base.html new file mode 100644 index 0000000..c40c56f --- /dev/null +++ b/news/templates/base.html @@ -0,0 +1,15 @@ + + + + + {% block title %} Placeholder {% endblock %} + + + + + + + {% include 'navbar.html' %} + {% block content %} Placeholder {% endblock %} + + \ No newline at end of file diff --git a/news/templates/navbar.html b/news/templates/navbar.html new file mode 100644 index 0000000..8477ca8 --- /dev/null +++ b/news/templates/navbar.html @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/news/templates/posts/index.html b/news/templates/posts/index.html new file mode 100644 index 0000000..b75142c --- /dev/null +++ b/news/templates/posts/index.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} + +{% block title %} +Index +{% endblock %} + +{% block content %} +
+

Index of News App

+

Some placeholder Text

+
+{% endblock %}