Skip to content

Commit

Permalink
use rew urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Tremesaygues committed Aug 14, 2024
1 parent dd796c9 commit 09269ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 41 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ $ pip install -Ur requirements.txt
## Dev

```shell
$ npm run dev &
$ npm run dev
# (in other shell)
$ ./manage.py runserver
```

## Prod

```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)
2 changes: 1 addition & 1 deletion jssg
Submodule jssg updated 2 files
+6 −2 README.md
+53 −0 jssg/utils.py
39 changes: 3 additions & 36 deletions proj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,7 @@

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
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/<slug:slug>.html",
views.PageView.as_view(),
name="page",
distill_func=get_pages,
),
distill_path(
"posts/<slug:slug>.html",
views.PostView.as_view(),
name="post",
distill_func=get_posts,
),
]
urlpatterns = []
urlpatterns += jssg_urls()

0 comments on commit 09269ce

Please sign in to comment.