Skip to main content
DjangoKit Log In

Pages

Pages are analogous to Django template URLs/views.

To add a new page to a DjangoKit project, you simply add a page.html somewhere under your project's routes directory (see Code Layout).

Using the DjangoKit CLI, you can add a page like so:

dk add-page <route_path>

<route_path> should be relative to your project's routes directory, so if you wanted to create a page called todo, you'd run dk add-page todo and you'd end up with a new subdirectory under routes:

<project>/src/<package>/routes/
    todo/
        page.html

This page will be accessible at the URL /todo.

page.html will contain a stub component for you to fill in.

You can also create and handler module to go along with a page route. Continuing with the TODO example, here's how you would create a todo page with an associated handler module:

dk add-page --with-handlers todo
<project>/src/<package>/routes/
    todo/
        __init__.py
        handlers.py
        page.html

See Handlers for more information on handlers.