Template + Bootstrap
This commit is contained in:
parent
0a3c1d8d26
commit
b1254fc736
@ -37,6 +37,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
'posts'
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -14,7 +14,8 @@ Including another URLconf
|
|||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import include, path
|
from django.urls import path,include
|
||||||
|
from posts import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('posts/', include('posts.urls')),
|
path('posts/', include('posts.urls')),
|
||||||
|
12
posts/templates/posts/about.html
Normal file
12
posts/templates/posts/about.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h2>Seite Infos</h2>
|
||||||
|
<p>
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus
|
||||||
|
massa non tortor. Vestibulum diam diam, posuere in viverra in,
|
||||||
|
ullamcorper et libero. Donec eget libero quis risus congue imperdiet ac
|
||||||
|
id lectus. Nam euismod cursus arcu, et consequat libero ullamcorper sit
|
||||||
|
amet.
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
15
posts/templates/posts/index.html
Normal file
15
posts/templates/posts/index.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="jumbotron">
|
||||||
|
<h2>Meine Posts !</h2>
|
||||||
|
<p>
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec rhoncus
|
||||||
|
massa non tortor. Vestibulum diam diam, posuere in viverra in,
|
||||||
|
ullamcorper et libero. Donec eget libero quis risus congue imperdiet ac
|
||||||
|
id lectus. Nam euismod cursus arcu, et consequat libero ullamcorper sit
|
||||||
|
amet.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@ -1,7 +1,9 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from posts import views
|
||||||
from . import views
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index'),
|
||||||
|
path('welcome', views.welcome_seite),
|
||||||
|
path('home', views.welcome_seite),
|
||||||
|
path('about', views.about_seite)
|
||||||
]
|
]
|
@ -1,5 +1,13 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def index(request):
|
def index(request):
|
||||||
return HttpResponse("Hello, world. You're at the posts index.")
|
return HttpResponse("Hello, world. You're at the posts index.")
|
||||||
|
|
||||||
|
def welcome_seite(request):
|
||||||
|
return render(request, 'posts/index.html')
|
||||||
|
|
||||||
|
def about_seite(request):
|
||||||
|
return render(request, 'posts/about.html')
|
36
templates/base.html
Normal file
36
templates/base.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
{# <link rel="stylesheet" href="/media/css/style.css" />#}
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
||||||
|
|
||||||
|
<title>{% block title %}First Django Application{% endblock %}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav>
|
||||||
|
{% block nav %}
|
||||||
|
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/posts/home">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://www.google.de/?hl=de">google</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://www.th-nuernberg.de/fakultaeten/efi/">Efi</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/posts/about">about</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endblock %}
|
||||||
|
</nav>
|
||||||
|
<section id="content">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</section>
|
||||||
|
<footer>© Danke</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user