1
Fork 0

Add homepage template view

This commit is contained in:
Jake Howard 2020-04-13 10:39:38 +01:00
parent e42e67efdc
commit d5c04c7dee
Signed by: jake
GPG Key ID: 57AFB45680EDD477
7 changed files with 45 additions and 2 deletions

23
templates/base.html Normal file
View File

@ -0,0 +1,23 @@
{% load static %}
<!DOCTYPE HTML>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Language" content="" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width" />
<link rel="alternate" type="application/rss+xml" href="" />
<meta name="superfish" content="nofish" />
<meta name="application-name" content="TheOrangeOne" />
<title>{% block title %}{% endblock %} :: TheOrangeOne</title>
<link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}" />
<link rel="stylesheet" href="{% static 'css/index.css' %}" />
</head>
<body>
{% block content %}{% endblock %}
<script type="text/javascript" src="{% static 'js/materialize.min.js' %}"></script>
</body>
</html>

7
templates/index.html Normal file
View File

@ -0,0 +1,7 @@
{% extends "base.html" %}
{% block title %}Homepage{% endblock %}
{% block content %}
Homepage content
{% endblock%}

View File

5
website/common/urls.py Normal file
View File

@ -0,0 +1,5 @@
from django.urls import path
from . import views
urlpatterns = [path("", views.HomepageView.as_view())]

5
website/common/views.py Normal file
View File

@ -0,0 +1,5 @@
from django.views.generic import TemplateView
class HomepageView(TemplateView):
template_name = "index.html"

View File

@ -38,6 +38,7 @@ INSTALLED_APPS = [
"whitenoise.runserver_nostatic",
"django.contrib.staticfiles",
"debug_toolbar",
"website.common",
]
MIDDLEWARE = [
@ -54,7 +55,7 @@ ROOT_URLCONF = "website.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"DIRS": [os.path.join(BASE_DIR, "templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [

View File

@ -2,7 +2,9 @@ import debug_toolbar
from django.conf import settings
from django.urls import include, path
urlpatterns = []
from website.common.urls import urlpatterns as common_urlpatterns
urlpatterns = [path("", include(common_urlpatterns))]
if settings.DEBUG:
urlpatterns.append(path("__debug__/", include(debug_toolbar.urls)))