Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

A Django-based application to manage, create and share Chartwerk charts.

Project Description

# ![chartwerk](docs/logo.png)

A Django-based application to manage, create and share Chartwerk charts, built with [Django REST framework](

For the React/Redux-based chart editor, see [chartwerk-editor](

## Assumptions

1. django-chartwerk uses Django's [JSONField]( field. Therefore, PostgreSQL is required. You can, however, separate django-chartwerk's database from others in your project easily by specifying a CHARTWERK_DB environment variable.

2. django-chartwerk is written to bake charts to Amazon Web Service's Simple Storage Service (S3). We assume that's your plan, too.

## Installation

1. Install `django-chartwerk`.

$ pip install django-chartwerk

2. Add AWS credentials to environment variables.

# .env
export AWS_ACCESS_KEY_ID=xxxyyyzzz
export AWS_SECRET_ACCESS_KEY=aaabbbcccddd

3. Add chartwerk's dependencies and the minimum configuration variables.

# project/

# ...


_Just trying out Chartwerk locally? Set the above CHARTWERK\_ variables to gibberish. They're only really needed when you start publishing charts but will throw errors if they aren't set._

4. Add chartwerk to your project's ``.

# project/

urlpatterns = [
# ...
url(r'^chartwerk/', include('chartwerk.urls')),

5. Chartwerk uses [Celery]( to process some tasks asynchronously. Read [First steps with Django]( to see how to setup a Celery app in your project. Here is a configuration you can also use to start:

# project/

import os

from celery import Celery
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', '<your project>.settings')

app = Celery('chartwerk')
app.config_from_object('django.conf:settings', namespace='CELERY')
# Use synchronous tasks in local dev
if settings.DEBUG:
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, related_name='celery')

# project/
from .celery import app as celery_app

__all__ = ['celery_app']

6. Make sure you have django-chartwerk connected to a PostgreSQL database. For example using [dj_database_url](

# .env
export DATABASE_URL=postgresql://user:password@

# project/
import dj_database_url

'default': dj_database_url.config()

7. Run migrations, start the dev server and enjoy!

$ python migrate
$ python runserver

## Configuration variables

Chartwerk allows you to set a number of configuration options. The preferred method of setting config is through environment variables, though most config options can also be set in your project settings using the same variable name. For those options that can be set in ``, environment variables override variables in your project settings if you declare them in both places.

### App settings


String module path to a decorator that should be applied to Chartwerk views to authenticate users. Defaults to `"django.contrib.auth.decorators.login_required"`, but can also be `"django.contrib.admin.views.decorators.staff_member_required"`, for example. (This decorator is not applied to views in DEBUG mode.)


If you aren't using PostgreSQL in your main project, you can separate the database for django-chartwerk from your other apps. Add the CHARTWERK_DB environment variable, a la [DATABASE_URL]( You can also add the database explicitly to the DATABASES dict in project settings as `"chartwerk"`.


Set this variable in your project settings to declare a default set of color schemes your users can select for chart elements. The schemes must be organized by type as a dictionary with keys `categorical`, `sequential` and `diverging`. Name each color scheme and then provide a list of hexadecimal color codes. For example:

'categorical': {
'default': [
# etc.
'sequential': {
'reds': [
# etc.
'blues': [
# etc.
'diverging': {
'redBlue': [
# etc.

### AWS Publishing


AWS access key ID. See [Environment Variables config for Boto3]( **Required as environment variable**


AWS secret access key. See [Environment Variables config for Boto3]( **Required as environment variable.**


AWS S3 bucket name to publish charts to. **Required.**


Path within your S3 bucket to append to object keys before publishing. Defaults to `"charts"`


Cache header to add to chart files when published to S3. Defaults to `"max-age=300"`.


The domain of the app running Chartwerk. For example, your app may be hosted at `""`. **Required.**


Absolute URL to your custom script for embedding Chartwerk charts in your CMS. **Required.**


URL to jQuery version you want to include in baked-out charts. Defaults to `""`.


If your CMS is configured to use oEmbed, set this setting to `True` which will return oEmbed code to users in the editor. Default is `False`.

### Github

django-chartwerk can commit your chart templates to a GitHub repository for safe keeping.


To keep templates in a repo under a GitHub organization, set this variable to the GitHub org name.


GitHub user password. Can only be set as an environment variable.


The name of the repo to save chart templates to. Defaults to `"chartwerk_chart-templates"`.


GitHub username. Can only be set as an environment variable.

### Slack

Chartwerk can send notifications to a Slack channel whenever a new chart is created.


Name of the Slack channel to post notifications to. Defaults to `"#chartwerk"`.


A Slack API token.

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(6.9 MB) Copy SHA256 Hash SHA256
Source May 31, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting