diff --git a/.gitignore b/.gitignore index 784fd7e..731713b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ db/data .venv gawa/gawa/__pycache__ gawa/start/__pycache__ +gawa/blog/__pycache__ diff --git a/docker-compose.yml b/docker-compose.yml index 3874c83..9831f8c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ services: db: image: mariadb - restart: always networks: - internal ports: @@ -30,7 +29,6 @@ services: - db phpmyadmin: image: phpmyadmin - restart: always networks: - internal ports: diff --git a/gawa/blog/__init__.py b/gawa/blog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gawa/blog/admin.py b/gawa/blog/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/gawa/blog/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/gawa/blog/apps.py b/gawa/blog/apps.py new file mode 100644 index 0000000..94788a5 --- /dev/null +++ b/gawa/blog/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class BlogConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'blog' diff --git a/gawa/blog/migrations/__init__.py b/gawa/blog/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gawa/blog/models.py b/gawa/blog/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/gawa/blog/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/gawa/blog/templates/blog/index.html b/gawa/blog/templates/blog/index.html new file mode 100644 index 0000000..a6c6226 --- /dev/null +++ b/gawa/blog/templates/blog/index.html @@ -0,0 +1 @@ +not implemented diff --git a/gawa/blog/tests.py b/gawa/blog/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/gawa/blog/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/gawa/blog/urls.py b/gawa/blog/urls.py new file mode 100644 index 0000000..1249c1c --- /dev/null +++ b/gawa/blog/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path("", views.IndexView.as_view(), name="index"), +] diff --git a/gawa/blog/views.py b/gawa/blog/views.py new file mode 100644 index 0000000..1cf3362 --- /dev/null +++ b/gawa/blog/views.py @@ -0,0 +1,13 @@ +from django.shortcuts import render +from django.views.generic.base import TemplateView + +class IndexView(TemplateView): + """ + The index page of the gawa/blog app. + + Utilizes a generic view, because I will do so for all views, + a regular view function would suffice. + """ + + template_name: str = "blog/index.html" + diff --git a/gawa/gawa/settings.py b/gawa/gawa/settings.py index 5ff725a..d3ecb62 100644 --- a/gawa/gawa/settings.py +++ b/gawa/gawa/settings.py @@ -35,6 +35,8 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'start.apps.StartConfig', + 'blog.apps.BlogConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/gawa/gawa/urls.py b/gawa/gawa/urls.py index 6171048..085ec84 100644 --- a/gawa/gawa/urls.py +++ b/gawa/gawa/urls.py @@ -18,5 +18,6 @@ from django.urls import include, path urlpatterns = [ path("", include("start.urls")), + path("blog/", include("blog.urls")), path('admin/', admin.site.urls), ] diff --git a/gawa/start/locale/de/LC_MESSAGES/django.po b/gawa/start/locale/de/LC_MESSAGES/django.po new file mode 100644 index 0000000..1cd68a6 --- /dev/null +++ b/gawa/start/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-29 22:26+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: start/templates/start/base.html:21 +msgid "Start" +msgstr "Start" + +#: start/templates/start/base.html:24 +msgid "Blog" +msgstr "Blog" diff --git a/gawa/start/locale/en/LC_MESSAGES/django.po b/gawa/start/locale/en/LC_MESSAGES/django.po new file mode 100644 index 0000000..1cd68a6 --- /dev/null +++ b/gawa/start/locale/en/LC_MESSAGES/django.po @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-29 22:26+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +#: start/templates/start/base.html:21 +msgid "Start" +msgstr "Start" + +#: start/templates/start/base.html:24 +msgid "Blog" +msgstr "Blog" diff --git a/gawa/start/templates/start/base.html b/gawa/start/templates/start/base.html new file mode 100644 index 0000000..484cee5 --- /dev/null +++ b/gawa/start/templates/start/base.html @@ -0,0 +1,129 @@ +{% load i18n %} + + + + {% block title %}{% endblock title %} + + + Bootstrap demo + + + + +
+ {% block main %}{% endblock main %} +
+
+
+ +
+
+
+
+
+
Information
+

+ {% blocktranslate %} + Ich habe diese Website selbst programmiert und gehostet. + Falls Sie einen Fehler belibiger Art finden, würde ich mich freuen, + wenn Sie mich darüber benachrichtigen. +

+ Die Suche nach Schwachstellen und Fehlern auf dieser Website ist für + diesen Zweck ausdrücklich erlaubt. + {% endblocktranslate %} +

+
+
+
+ Links +
+

+ GitHub +

+

+ Selfhosted Git +

+
+
+
+ Leer +
+
+
+
{% translate "Contact" %}
+

Christoph Johannes Scherr

+

+ Leininger Straße 20,
+ Maxdorf 67133,
+ {% translate "Deutschland" %} +

+

+ contact@cscherr.de +

+
+
+
+
+
+ © 2023 Christoph J. Scherr +
+ cscherr.de +
+
+ + + diff --git a/gawa/start/templates/start/index.html b/gawa/start/templates/start/index.html new file mode 100644 index 0000000..c001df7 --- /dev/null +++ b/gawa/start/templates/start/index.html @@ -0,0 +1,13 @@ +{% extends 'start/base.html' %} +{% load i18n %} +{% get_current_language as LANGUAGE_CODE %} +{% block languagecode %}{{ LANGUAGE_CODE }}{% endblock languagecode %} +{% block title %}{% translate "cscherr.de" %} - {% translate "startpage" %}{% endblock title %} +{% block main %} +
+

My First Bootstrap Page

+

Resize this responsive page to see the effect!

+
+
+
+{% endblock main %} diff --git a/gawa/start/urls.py b/gawa/start/urls.py index 5119061..1249c1c 100644 --- a/gawa/start/urls.py +++ b/gawa/start/urls.py @@ -3,5 +3,5 @@ from django.urls import path from . import views urlpatterns = [ - path("", views.index, name="index"), + path("", views.IndexView.as_view(), name="index"), ] diff --git a/gawa/start/views.py b/gawa/start/views.py index 76325c4..b872669 100644 --- a/gawa/start/views.py +++ b/gawa/start/views.py @@ -1,5 +1,16 @@ from django.http import HttpResponse +from django.views.generic.base import TemplateView +from django.views import View +from django.template import Template, loader -def index(request): - return HttpResponse("This is the start of everything") +class IndexView(TemplateView): + """ + The index page of the gawa app. + + Utilizes a generic view, because I will do so for all views, + a regular view function would suffice. + """ + + template_name: str = "start/index.html" + diff --git a/web/Dockerfile b/web/Dockerfile index 8b6eaeb..62286c3 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -3,6 +3,8 @@ FROM python:3 ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && apt install -y gettext && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/ RUN pip install -r requirements.txt COPY . /app/