Przeglądaj źródła

use templating

master
erichhasl 8 lat temu
rodzic
commit
2cd00e88bf
5 zmienionych plików z 22 dodań i 3 usunięć
  1. +5
    -1
      web_dev/sas_web/sas_web/settings.py
  2. +7
    -0
      web_dev/sas_web/startpage/templates/startpage/index.html
  3. +2
    -2
      web_dev/sas_web/startpage/views.py
  4. +0
    -0
      web_dev/sas_web/static/public/images/apb_icon.png
  5. +8
    -0
      web_dev/sas_web/templates/public/base.html

+ 5
- 1
web_dev/sas_web/sas_web/settings.py Wyświetl plik

@@ -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")
]

+ 7
- 0
web_dev/sas_web/startpage/templates/startpage/index.html Wyświetl plik

@@ -0,0 +1,7 @@
{% extends "public/base.html" %}

{% block content %}
<h2>Hi</h2>

<p>Blabla!</p>
{% endblock %}

+ 2
- 2
web_dev/sas_web/startpage/views.py Wyświetl plik

@@ -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', {})

web_dev/apb_icon.png → web_dev/sas_web/static/public/images/apb_icon.png Wyświetl plik


+ 8
- 0
web_dev/sas_web/templates/public/base.html Wyświetl plik

@@ -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>

Ładowanie…
Anuluj
Zapisz