kopia lustrzana https://github.com/wagtail/wagtail
Static site generation docs update
Formatting tweaks and S3 / Google App Engine options.pull/173/merge
rodzic
5f4cc1fa91
commit
99c9d875be
|
@ -1,20 +1,20 @@
|
|||
Generating a static site
|
||||
========================
|
||||
|
||||
This document describes how to render your Wagtail site into static HTML files using `django medusa`_ and the 'wagtail.contrib.wagtailmedusa' module.
|
||||
This document describes how to render your Wagtail site into static HTML files on your local filesystem, Amazon S3 or Google App Engine, using `django medusa`_ and the ``wagtail.contrib.wagtailmedusa`` module.
|
||||
|
||||
|
||||
Installing django-medusa
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Firstly, install django medusa from pip:
|
||||
First, install django medusa from pip:
|
||||
|
||||
.. code::
|
||||
|
||||
pip install django-medusa
|
||||
|
||||
|
||||
Then add 'django_medusa' and 'wagtail.contrib.wagtailmedusa' to INSTALLED_APPS:
|
||||
Then add ``django_medusa`` and ``wagtail.contrib.wagtailmedusa`` to ``INSTALLED_APPS``:
|
||||
|
||||
.. code:: python
|
||||
|
||||
|
@ -28,9 +28,9 @@ Then add 'django_medusa' and 'wagtail.contrib.wagtailmedusa' to INSTALLED_APPS:
|
|||
Replacing GET parameters with custom routing
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Pages which require GET parameters (eg, pagination) don't generate suitable filenames for generated HTML files so they need to be changed to use custom routing instead.
|
||||
Pages which require GET parameters (e.g. for pagination) don't generate suitable filenames for generated HTML files so they need to be changed to use custom routing instead.
|
||||
|
||||
For example, lets say we have a Blog Index which uses pagination. We can override the 'route' method to make it respond on urls like '/page/1' and pass the page number through to the serve method:
|
||||
For example, let's say we have a Blog Index which uses pagination. We can override the ``route`` method to make it respond on urls like '/page/1', and pass the page number through to the ``serve`` method:
|
||||
|
||||
.. code:: python
|
||||
|
||||
|
@ -53,7 +53,7 @@ For example, lets say we have a Blog Index which uses pagination. We can overrid
|
|||
Rendering pages which use custom routing
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For page types that override the route method, we need to let django medusa know which URLs it responds on. This is done by overriding the 'get_static_site_paths' method to make it yield one string per URL path.
|
||||
For page types that override the ``route`` method, we need to let django medusa know which URLs it responds on. This is done by overriding the ``get_static_site_paths`` method to make it yield one string per URL path.
|
||||
|
||||
For example, the BlogIndex above would need to yield one URL for each page of results:
|
||||
|
||||
|
@ -75,7 +75,7 @@ For example, the BlogIndex above would need to yield one URL for each page of re
|
|||
Rendering
|
||||
~~~~~~~~~
|
||||
|
||||
To render a site, just run ``./manage.py staticsitegen``. This will render the entire website and place the HTML in a folder called 'medusa_output'. The static and media folders need to be copied into this folder manually after the rendering is complete.
|
||||
To render a site, run ``./manage.py staticsitegen``. This will render the entire website and place the HTML in a folder called 'medusa_output'. The static and media folders need to be copied into this folder manually after the rendering is complete. This feature inherits django-medusa's ability to render your static site to Amazon S3 or Google App Engine; see the `medusa docs <https://github.com/mtigas/django-medusa/blob/master/README.markdown>`_ for configuration details.
|
||||
|
||||
To test, open the 'medusa_output' folder in a terminal and run ``python -m SimpleHTTPServer``.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue