use templating

This commit is contained in:
erichhasl
2017-11-17 23:55:53 +01:00
parent 9e63be6b00
commit 2cd00e88bf
5 changed files with 22 additions and 3 deletions
+5 -1
View File
@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'startpage',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -55,7 +56,7 @@ ROOT_URLCONF = 'sas_web.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -104,3 +105,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]
@@ -0,0 +1,7 @@
{% extends "public/base.html" %}
{% block content %}
<h2>Hi</h2>
<p>Blabla!</p>
{% endblock %}
+2 -2
View File
@@ -1,6 +1,6 @@
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse("Hey!")
return render(request, 'startpage/index.html', {})

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

@@ -0,0 +1,8 @@
{% load static %}
<img src="{% static "public/images/apb_icon.png" %}" />
{% block content %}
{% endblock %}
<p>Impressum: N.H (der ist für alles hier verantwortlich)</p>