Skip to main content

actionkit-templates allows you to view your ActionKit templates locally testing different configurations for each page type. It also documents by-code many context variables for each page

Project description

ActionKit Template Renderer

### What this is

If you use [ActionKit]( and edit its templates, then you might want to see what they look like
locally. If you install this (`pip install actionkit-templates`) then you can run

aktemplates runserver

You can also run it on a different port than the default like so:

aktemplates runserver

in a directory where you have a set of ActionKit templates (`wrapper.html`, etc), then you can
view them on from a local port. This runs Django in a similar environment that ActionKit
runs itself.


You can set some environment variables that will help you develop locally (e.g. static file versions).

This is a 0.1 codebase, so things might change across versions -- probably limiting the full Django context and to expose those things by commandline, instead. In the meantime, you can
look at `actionkit_templates/` and search for `os.environ` for what it does.

: By default we search the local directory and a directory called template_set. If you run:

TEMPLATE_DIR=actionkittemplates aktemplates runserver

it will also look in the directory `actionkittemplates/`

: By default we serve the `./static/` directory at /static/ This goes well with code in your
wrapper.html template like this:
{% if args.env == "dev" or devenv.enabled or 'devdevdev' in page.custom_fields.layout_options %}
<!-- development of stylesheets locally -->
<link href="/static/stylesheets/site.css" rel="stylesheet" />
{% else %}
<!-- production location of stylesheets -->
<link href="https://EXAMPLE.COM/static/stylesheets/site.css" rel="stylesheet" />
{% endif %}

: In the occasional moment when you are developing without an internet connection this will fail
to load:

{% load_js %}
{% end %}

In that situation, if you set STATIC_FALLBACK to a directory where, e.g. `jquery.min.js`
is present, then it will look for all the internet-external files in that directory.
Note that this only works with `load_js` and `load_css` template tags.

Contributing When You Run Into Something Not Covered

Template Tags

Usually, these are easy to add here `actionkit_templates/templatetags/`
We should aim for support of all these:

Extra contexts

If you make a context that's not covered already, please contribute with a patch to
`actionkit_templates/contexts/` Note that these are also useful to browser, to see
what variables you can access from a particular page context.

Project details

Release history Release notifications | RSS feed

This version


Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page