From 677e85a0f7c2c6d8ea02c5d3e14dbba59058f937 Mon Sep 17 00:00:00 2001 From: eneller Date: Sun, 16 Mar 2025 11:53:21 +0100 Subject: [PATCH] feat: basic template --- src/epub2go_web/settings.py | 16 +++---- src/epub2go_web/templates/index.html | 63 ++++++++++++++++++++++++++++ src/epub2go_web/urls.py | 18 ++++++++ 3 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 src/epub2go_web/templates/index.html diff --git a/src/epub2go_web/settings.py b/src/epub2go_web/settings.py index 62f2791..f19ffae 100644 --- a/src/epub2go_web/settings.py +++ b/src/epub2go_web/settings.py @@ -54,7 +54,9 @@ ROOT_URLCONF = "epub2go_web.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [ + 'epub2go_web/templates/' + ], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -73,12 +75,12 @@ WSGI_APPLICATION = "epub2go_web.wsgi.application" # Database # https://docs.djangoproject.com/en/5.1/ref/settings/#databases -DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": BASE_DIR / "db.sqlite3", - } -} +#DATABASES = { +# "default": { +# "ENGINE": "django.db.backends.sqlite3", +# "NAME": BASE_DIR / "db.sqlite3", +# } +#} # Password validation diff --git a/src/epub2go_web/templates/index.html b/src/epub2go_web/templates/index.html new file mode 100644 index 0000000..0015cad --- /dev/null +++ b/src/epub2go_web/templates/index.html @@ -0,0 +1,63 @@ + + + +{{ title }} + + +
+

{{ title }}

+ +
+ +
+
+
+ + {% for item in items %} + + + + + {% endfor %} +
+ + {{ item.title }} + + Download
+ + + + diff --git a/src/epub2go_web/urls.py b/src/epub2go_web/urls.py index e6f1364..ec8b32d 100644 --- a/src/epub2go_web/urls.py +++ b/src/epub2go_web/urls.py @@ -17,7 +17,25 @@ Including another URLconf from django.contrib import admin from django.urls import path +from django.http import HttpRequest, HttpResponse +from django.shortcuts import render, redirect + +def root(request:HttpRequest): + title = 'epub2go' + targetParam = request.GET.get('t', None) + if targetParam is not None: + getEpub(targetParam) + return render(request, 'index.html', locals()) urlpatterns = [ path("admin/", admin.site.urls), + path('',root, name='root') ] + +def getEpub(param): + # TODO validate / sanitize input + # TODO check for existing file and age + # TODO download + # TODO redirect to loading page + # TODO redirect to download page + raise NotImplementedError