From b25b9fd159ad12eda1754004d41d07468fba1fb7 Mon Sep 17 00:00:00 2001 From: Dorian Lesbre <dorian.lesbre@gmail.com> Date: Thu, 24 Dec 2020 10:02:52 +0100 Subject: [PATCH] Moved home.html template to home app --- home/templates/home.html | 15 +++++++++++++++ home/urls.py | 6 ++++++ home/views.py | 3 ++- interludes/templates/home.html | 9 --------- interludes/urls.py | 5 ++--- 5 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 home/templates/home.html create mode 100644 home/urls.py delete mode 100644 interludes/templates/home.html diff --git a/home/templates/home.html b/home/templates/home.html new file mode 100644 index 0000000..130f076 --- /dev/null +++ b/home/templates/home.html @@ -0,0 +1,15 @@ +{% load static %} +<!doctype html> +<html lang=fr> + <head> + <title>Site title</title> + <meta charset="utf-8"> + + <link rel="stylesheet" href="{% static 'css/style.css' %}"> + </head> + <body> + <h1>A Title</h1> + <p>a paragraph</p> + <p>another paragraph</p> + </body> +</html> \ No newline at end of file diff --git a/home/urls.py b/home/urls.py new file mode 100644 index 0000000..355175e --- /dev/null +++ b/home/urls.py @@ -0,0 +1,6 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.home, name = 'home'), +] \ No newline at end of file diff --git a/home/views.py b/home/views.py index 91ea44a..795eb43 100644 --- a/home/views.py +++ b/home/views.py @@ -1,3 +1,4 @@ from django.shortcuts import render -# Create your views here. +def home(request): + return render(request, 'home.html', {}) \ No newline at end of file diff --git a/interludes/templates/home.html b/interludes/templates/home.html deleted file mode 100644 index bdccf68..0000000 --- a/interludes/templates/home.html +++ /dev/null @@ -1,9 +0,0 @@ -<html> - <head> - <title>Site title</title> - </head> - <body> - <p>a paragraph</p> - <p>another paragraph</p> - </body> -</html> \ No newline at end of file diff --git a/interludes/urls.py b/interludes/urls.py index cdd6051..0a9aeb4 100644 --- a/interludes/urls.py +++ b/interludes/urls.py @@ -14,10 +14,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path -from interludes import views +from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), - path('', views.home, name = 'home') + path('', include('home.urls')), ] -- GitLab