From 09269ce2f745c781a3006ba56b5cca741a4c8729 Mon Sep 17 00:00:00 2001 From: Jonathan Tremesaygues Date: Wed, 14 Aug 2024 18:33:08 +0200 Subject: [PATCH] use rew urls --- README.md | 10 ++++++---- jssg | 2 +- proj/urls.py | 39 +++------------------------------------ 3 files changed, 10 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 4cb50e9..c28ce7d 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ $ pip install -Ur requirements.txt ## Dev ```shell -$ npm run dev & +$ npm run dev +# (in other shell) $ ./manage.py runserver ``` @@ -28,12 +29,13 @@ $ ./manage.py runserver ```shell $ npm run build -$ ./manage.py collectstatic --no-input -$ ./manage.py gensite +$ ./manage.py distill-local --collectstatic --force dist ``` Or, if you prefer docker ```shell -$ docker build -t jssg . +$ make docker-image ``` + +(`make` for building and runnnig the image) diff --git a/jssg b/jssg index 5199cbd..f49e8a7 160000 --- a/jssg +++ b/jssg @@ -1 +1 @@ -Subproject commit 5199cbd88f510ddc10bb40899f24a34278447580 +Subproject commit f49e8a74c51dd143684cb96afa13c873735e0301 diff --git a/proj/urls.py b/proj/urls.py index 192c169..a32a5e4 100644 --- a/proj/urls.py +++ b/proj/urls.py @@ -13,40 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from collections.abc import Iterable -from typing import Any +from jssg.utils import jssg_urls -from django_distill import distill_path - -from jssg import views -from jssg.models import find_pages, find_posts - - -def get_pages() -> Iterable[dict[str, Any]]: - """Get available pages.""" - return ({"slug": p.slug} for p in find_pages()) - - -def get_posts(): - """Get available posts.""" - return ({"slug": p.slug} for p in find_posts()) - - -urlpatterns = [ - distill_path( - "", views.IndexView.as_view(), name="index", distill_file="index.html" - ), - distill_path("atom.xml", views.PostFeedsView(), name="atom_feed"), - distill_path( - "pages/.html", - views.PageView.as_view(), - name="page", - distill_func=get_pages, - ), - distill_path( - "posts/.html", - views.PostView.as_view(), - name="post", - distill_func=get_posts, - ), -] +urlpatterns = [] +urlpatterns += jssg_urls()