by newhub-spec



In the beginning God created man, and the costs followed afterwards.

This project is a concrete integration of the django-accounting application. It is ready to be deployed on Heroku, but you can deploy on which provider you want.


Under the hood

  • Python 3.3
  • Django 1.7+
  • dj-static
  • Already configured for an Heroku deploy


Maybe you want to integrate the accounting engine into your existing project, so check out the features offered by django-accounting.

Local install

First create the virtualenv with the right python version

$ mkvirtualenv accountant --python=$(which python3)
$ workon accountant

Install the dependencies

$ pip install -r reqs/dev.txt
$ npm install

Create the local database

$ createdb accountant
$ ./ migrate

Now run the server :

$ ./ runserver

Deploy the beast

Prepare the static server

create a new user

$ aws iam create-user --user-name heroku-accountant


    "User": {
        "UserName": "heroku-accountant",
        "Path": "/",
        "CreateDate": "2015-01-22T14:10:08.058Z",
        "UserId": "<user_id>",
        "Arn": "arn:aws:iam::<user_arn_id>:user/heroku-accountant"

give the user some access keys

$ aws iam create-access-key --user-name heroku-accountant


    "AccessKey": {
        "UserName": "heroku-accountant",
        "Status": "Active",
        "CreateDate": "2015-01-22T14:18:56.237Z",
        "SecretAccessKey": "<secret_key>",
        "AccessKeyId": "<access_key>"

Write down the <secret_key> and <access_key> values, so that we can give the values to the heroku app.

create the aws bucket

$ aws s3 mb s3://accountantx --region eu-west-1

give the user access to the created bucket

$ aws iam put-user-policy --user-name heroku-accountant --policy-name AmazonS3FullAccess-heroku-accountant --policy-document '{
    "Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
            "Action": [
            "Resource": "arn:aws:s3:::accountantx",
            "Condition": {}
            "Effect": "Allow",
            "Action": [
            "Resource": "arn:aws:s3:::accountantx/*",
            "Condition": {}

Deploy the app

We need to specify the buildpack to use otherwise heroku won't know which one to choose, due to the fact that both package.json and requirements.txt files exist.

Lancer les commandes dans l'ordre ci-dessous:

$ heroku create accountant-x --region eu
$ heroku config:add BUILDPACK_URL=git://
$ heroku addons:add heroku-postgresql:hobby-dev
$ heroku addons:add mandrill:starter
$ heroku addons:add newrelic:wayne
$ heroku config:set DJANGO_SETTINGS_MODULE=""
$ heroku config:set SECRET_KEY=`openssl rand -base64 32`
$ heroku config:set LOCAL_SERVER=0
$ heroku config:set
$ heroku config:set DISABLE_COLLECTSTATIC=1
$ heroku config:set AWS_STORAGE_BUCKET_NAME=accountantx AWS_S3_ACCESS_KEY_ID="<access_key>" AWS_S3_SECRET_ACCESS_KEY="<secret_key>"
$ git push heroku master
$ ./ collectstatic --noinput
$ aws s3 sync --acl public-read accountant/static s3://accountantx/static/
$ heroku run python migrate
$ heroku run python createsuperuser
$ heroku open

And you're done !


I've defined some shortcuts in the Makefile, feel free to explore those or add yours.

deploy to production

$ make dp

deploy & migrate to production

$ make dmp

collectstatic to production

$ make cp


Pierre Dulac


Accounting is available under the MIT license. See the LICENSE file for more info.