working basic base with bs5 and i18n
This commit is contained in:
parent
f8066a31a1
commit
381945d60d
|
@ -3,3 +3,4 @@ db/data
|
||||||
.venv
|
.venv
|
||||||
gawa/gawa/__pycache__
|
gawa/gawa/__pycache__
|
||||||
gawa/start/__pycache__
|
gawa/start/__pycache__
|
||||||
|
gawa/blog/__pycache__
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
restart: always
|
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
ports:
|
ports:
|
||||||
|
@ -30,7 +29,6 @@ services:
|
||||||
- db
|
- db
|
||||||
phpmyadmin:
|
phpmyadmin:
|
||||||
image: phpmyadmin
|
image: phpmyadmin
|
||||||
restart: always
|
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class BlogConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'blog'
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
|
@ -0,0 +1 @@
|
||||||
|
not implemented
|
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
|
@ -0,0 +1,7 @@
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", views.IndexView.as_view(), name="index"),
|
||||||
|
]
|
|
@ -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"
|
||||||
|
|
|
@ -35,6 +35,8 @@ ALLOWED_HOSTS = []
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
'start.apps.StartConfig',
|
||||||
|
'blog.apps.BlogConfig',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
|
|
|
@ -18,5 +18,6 @@ from django.urls import include, path
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", include("start.urls")),
|
path("", include("start.urls")),
|
||||||
|
path("blog/", include("blog.urls")),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
|
@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\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"
|
|
@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\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"
|
|
@ -0,0 +1,129 @@
|
||||||
|
{% load i18n %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{% block languagecode %}{% endblock languagecode %}">
|
||||||
|
<head>
|
||||||
|
<title>{% block title %}{% endblock title %}</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Bootstrap demo</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="#">
|
||||||
|
<img src="https://static.cscherr.de/images/profile/profile-margin.png" alt="Logo" height="30" class="d-inline-block align-text-top">
|
||||||
|
{% translate "cscherr.de" noop %}
|
||||||
|
</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" aria-current="page" href="/">{% translate "Start" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="/blog">{% translate "Blog" %}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
Dropdown
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a class="dropdown-item" href="#">Action</a></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Another action</a></li>
|
||||||
|
<li><hr class="dropdown-divider"></li>
|
||||||
|
<li><a class="dropdown-item" href="#">Something else here</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<form class="d-flex" role="search">
|
||||||
|
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
|
||||||
|
<button class="btn btn-outline-success" type="submit">Search</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<main>
|
||||||
|
{% block main %}{% endblock main %}
|
||||||
|
</main>
|
||||||
|
<footer class="text-center text-lg-start bg-white text-muted">
|
||||||
|
<section class="d-flex justify-content-center justify-content-lg-between p-4 border-bottom">
|
||||||
|
<div>
|
||||||
|
<a href="" class="me-4 link-secondary">
|
||||||
|
<i class="fab fa-facebook-f"></i>
|
||||||
|
</a>
|
||||||
|
<a href="" class="me-4 link-secondary">
|
||||||
|
<i class="fab fa-twitter"></i>
|
||||||
|
</a>
|
||||||
|
<a href="" class="me-4 link-secondary">
|
||||||
|
<i class="fab fa-google"></i>
|
||||||
|
</a>
|
||||||
|
<a href="" class="me-4 link-secondary">
|
||||||
|
<i class="fab fa-instagram"></i>
|
||||||
|
</a>
|
||||||
|
<a href="" class="me-4 link-secondary">
|
||||||
|
<i class="fab fa-linkedin"></i>
|
||||||
|
</a>
|
||||||
|
<a href="" class="me-4 link-secondary">
|
||||||
|
<i class="fab fa-github"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="">
|
||||||
|
<div class="container text-center text-md-start mt-5">
|
||||||
|
<div class="row mt-3">
|
||||||
|
<div class="col-md-3 col-lg-4 col-xl-3 mx-auto mb-4">
|
||||||
|
<h6 class="text-uppercase fw-bold mb-4">Information</h6>
|
||||||
|
<p>
|
||||||
|
{% 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.
|
||||||
|
<br><br>
|
||||||
|
Die Suche nach Schwachstellen und Fehlern auf dieser Website ist für
|
||||||
|
diesen Zweck ausdrücklich erlaubt.
|
||||||
|
{% endblocktranslate %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
|
||||||
|
<h6 class="text-uppercase fw-bold mb-4">
|
||||||
|
Links
|
||||||
|
</h6>
|
||||||
|
<p>
|
||||||
|
<a href="https://github.com/plexsheep" class="text-reset">GitHub</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="https://git.cscherr.de" class="text-reset">Selfhosted Git</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 col-lg-2 col-xl-2 mx-auto mb-4">
|
||||||
|
<h6 class="text-uppercase fw-bold mb-4">
|
||||||
|
Leer
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 col-lg-3 col-xl-3 mx-auto mb-md-0 mb-4">
|
||||||
|
<h6 class="text-uppercase fw-bold mb-4">{% translate "Contact" %}</h6>
|
||||||
|
<p>Christoph Johannes Scherr</p>
|
||||||
|
<p><i class="fas fa-home me-3 text-secondary">
|
||||||
|
Leininger Straße 20,<br>
|
||||||
|
Maxdorf 67133,<br>
|
||||||
|
{% translate "Deutschland" %}
|
||||||
|
</i></p>
|
||||||
|
<p>
|
||||||
|
<a href="mailto:contact@cscherr.de">contact@cscherr.de</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<div class="text-center p-4" style="background-color: rgba(0, 0, 0, 0.025);">
|
||||||
|
© 2023 Christoph J. Scherr
|
||||||
|
<br>
|
||||||
|
<a class="text-reset fw-bold" href="https://www.cscherr.de/">cscherr.de</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</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 %}
|
||||||
|
<div class="jumbotron text-center">
|
||||||
|
<h1>My First Bootstrap Page</h1>
|
||||||
|
<p>Resize this responsive page to see the effect!</p>
|
||||||
|
</div>
|
||||||
|
<div class="container-fluid">
|
||||||
|
</div>
|
||||||
|
{% endblock main %}
|
|
@ -3,5 +3,5 @@ from django.urls import path
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.index, name="index"),
|
path("", views.IndexView.as_view(), name="index"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
from django.http import HttpResponse
|
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):
|
class IndexView(TemplateView):
|
||||||
return HttpResponse("This is the start of everything")
|
"""
|
||||||
|
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"
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ FROM python:3
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
RUN apt update && apt install -y gettext && rm -rf /var/lib/apt/lists/*
|
||||||
COPY requirements.txt /app/
|
COPY requirements.txt /app/
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
Loading…
Reference in New Issue