From 523025517fec16f2972cb906598d7de6a559ae8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=A0krab=C3=A1nek?= Date: Fri, 10 Jun 2022 09:46:05 +0200 Subject: [PATCH] update --- firstapp/static/firstapp/h1.css | 1 + firstapp/templates/a_base.html | 17 +++++++++++++++++ firstapp/templates/a_home.html | 6 ++++++ firstapp/templates/a_index.html | 14 +++++--------- firstapp/urls.py | 1 + firstapp/views.py | 5 ++++- poznamky.md | 6 ++++++ print.py | 3 ++- reproject/settings.py | 3 +++ static/h1.css | 1 + 10 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 firstapp/static/firstapp/h1.css create mode 100644 firstapp/templates/a_base.html create mode 100644 firstapp/templates/a_home.html create mode 100644 poznamky.md create mode 100644 static/h1.css diff --git a/firstapp/static/firstapp/h1.css b/firstapp/static/firstapp/h1.css new file mode 100644 index 0000000..e2f46f3 --- /dev/null +++ b/firstapp/static/firstapp/h1.css @@ -0,0 +1 @@ +h1 {color: green;} \ No newline at end of file diff --git a/firstapp/templates/a_base.html b/firstapp/templates/a_base.html new file mode 100644 index 0000000..142a058 --- /dev/null +++ b/firstapp/templates/a_base.html @@ -0,0 +1,17 @@ +{% load static %} + + + + + + + {% block title %} {% endblock %} + + + +

First APP preview

+ + {% block content%} + {% endblock %} + + \ No newline at end of file diff --git a/firstapp/templates/a_home.html b/firstapp/templates/a_home.html new file mode 100644 index 0000000..041f299 --- /dev/null +++ b/firstapp/templates/a_home.html @@ -0,0 +1,6 @@ +{% extends "a_base.html" %} + +{% block content %} +

First Home

+

Index

+{% endblock %} diff --git a/firstapp/templates/a_index.html b/firstapp/templates/a_index.html index 1af395d..00dc0f6 100644 --- a/firstapp/templates/a_index.html +++ b/firstapp/templates/a_index.html @@ -1,10 +1,6 @@ - - - - - Index A - - +{% extends "a_base.html" %} + +{% block content %}

Index A

- - \ No newline at end of file +

A_Home

+{% endblock %} diff --git a/firstapp/urls.py b/firstapp/urls.py index a5b7669..8303e03 100644 --- a/firstapp/urls.py +++ b/firstapp/urls.py @@ -4,4 +4,5 @@ from . import views urlpatterns = [ path("",views.a_index, name='a_index'), + path("home/",views.a_home, name="a_home") ] diff --git a/firstapp/views.py b/firstapp/views.py index f179d44..bd1d5a8 100644 --- a/firstapp/views.py +++ b/firstapp/views.py @@ -2,4 +2,7 @@ from django.shortcuts import render # Create your views here. def a_index(request): - return render(request,"a_index.html") \ No newline at end of file + return render(request,"a_index.html") + +def a_home(request): + return render(request,"a_home.html") \ No newline at end of file diff --git a/poznamky.md b/poznamky.md new file mode 100644 index 0000000..f75f82b --- /dev/null +++ b/poznamky.md @@ -0,0 +1,6 @@ +python manage.py runserver +python manage.py migrate + +.venv\Scripts\activate.bat +pip list +pip install django \ No newline at end of file diff --git a/print.py b/print.py index 1dc45ac..147d1da 100644 --- a/print.py +++ b/print.py @@ -1 +1,2 @@ -print("Hello World!") \ No newline at end of file +print("Hello World!") + diff --git a/reproject/settings.py b/reproject/settings.py index 27bb25c..e22c993 100644 --- a/reproject/settings.py +++ b/reproject/settings.py @@ -120,6 +120,9 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = '/static/' +STATICFILES_DIRS = [ + BASE_DIR / "static" +] # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field diff --git a/static/h1.css b/static/h1.css new file mode 100644 index 0000000..e2f46f3 --- /dev/null +++ b/static/h1.css @@ -0,0 +1 @@ +h1 {color: green;} \ No newline at end of file