'django.contrib.sessions', | 'django.contrib.sessions', | ||||
'django.contrib.messages', | 'django.contrib.messages', | ||||
'django.contrib.staticfiles', | 'django.contrib.staticfiles', | ||||
'posts' | |||||
] | ] | ||||
MIDDLEWARE = [ | MIDDLEWARE = [ |
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')), |
{% 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 %} |
{% 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 %} |
from django.urls import path | from django.urls import path | ||||
from . import views | |||||
from posts 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) | |||||
] | ] |
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') |
<!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> |