Get started
Using with nanodjango
See How-tos for a full nanodjango example.
Install nanodjango along with its dependencies for static site generation, including django-nanopages and django-distill:
pip install nanodjango[static]
In your nanodjango script, register your directory of pages at a URL, at the end of your script:
app.pages(url="", path="pages/")
Put your markdown, HTML, or Django template files under the
path- in this case, a dir next to your script calledpages.Optional: build to a static site with django-distill:
nanodjango manage myscript.py distill-local static_site/
See Static site generation for more details about static site generation.
Using with full Django
Install:
pip install django-nanopages
Add it to your
INSTALLED_APPSinsettings.py:INSTALLED_APPS = [ ... "django_nanopages", ]
In your
urls.py, register your directory of pages at a URL:from django_nanopages import Pages urlpatterns = [ ... path("", include(Pages("pages/"))), ]
Put your markdown, HTML, or Django template files under the
path- in this case, a dir calledpages.Optional: build to a static site with django-distill:
./manage.py distill-local static_site/
See Static site generation for more details about static site generation.
Automatic browser reloading
django-nanopages integrates with [django-browser-reload](https://github.com/adamchainz/django-browser-reload) for automatic browser reloading when you make changes to files within a page directory.
Follow the installation instructions for [django-browser-reload](https://github.com/adamchainz/django-browser-reload), and your page directories will be automatically registered when it is available.