Merge pull request #2 from tldtest/basic_web

preping views
This commit is contained in:
Arnold Dechamps 2024-02-23 22:49:04 +01:00 committed by GitHub
commit 56f673ff3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 46 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python # This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application name: Flake 8
on: on:
push: push:

View file

@ -38,7 +38,8 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'admin_extra_buttons', 'admin_extra_buttons',
'tldtester', 'tldtester.apps.TldtesterConfig',
'tldtest',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -56,7 +57,7 @@ ROOT_URLCONF = 'tldtest.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], "DIRS": [BASE_DIR / "templates"],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [

View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block title %}Error 404{% endblock %}
{% block content %}
<img src="https://http.cat/images/404.jpg">
{% endblock content %}

View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block title %}Error 404{% endblock %}
{% block content %}
<img src="https://http.cat/images/500.jpg">
{% endblock content %}

View file

@ -0,0 +1,12 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}TLD Tester{% endblock %}</title>
</head>
<body>
{% block content %}
{% endblock content %}
</body>
</html>

View file

@ -0,0 +1,4 @@
{% extends "base.html" %}
{% block content %}
Hello World
{% endblock content %}

View file

@ -15,7 +15,9 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from .views import Index
urlpatterns = [ urlpatterns = [
path("", Index.as_view(), name="home"),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]

14
tldtest/views.py Normal file
View file

@ -0,0 +1,14 @@
from django.shortcuts import render
from django.views.generic import TemplateView
class Index(TemplateView):
template_name = 'home.html'
def handler404(request):
return render(request, '404.html', status=404)
def handler500(request):
return render(request, '500.html', status=500)