Skip to content
Crowdfunding platform for emerging musicians.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


The world's first fan run record label

Build Status codecov Codacy Badge



PerDiem requires memcached, PostgreSQL, libjpeg-dev, and Python header files, which you can install on debian with:

$ sudo apt-get install memcached postgresql postgresql-contrib python3-dev libssl-dev libpq-dev libjpeg-dev


Use poetry to install Python dependencies:

poetry install


Next we will need to create a file in the settings directory called This is where we will store all of the settings that are specific to your instance of PerDiem. Most of these settings should be only known to you. Your file should subclass BaseSettings from and then define a secret key and the database credentials. You will also need to define your development keys and secrets from Google, Facebook, Stripe, and MailChimp. Your file might look something like:

from perdiem.settings.base import BaseSettings

class DevSettings(BaseSettings):
    SECRET_KEY = '-3f5yh&(s5%9uigtx^yn=t_woj0@90__fr!t2b*96f5xoyzb%b'
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'perdiem',
            'USER': 'postgres',
            'PASSWORD': 'abc123',
            'HOST': 'localhost',
            'PORT': '5432',
    PINAX_STRIPE_PUBLIC_KEY = 'pk_test_abc123'
    PINAX_STRIPE_SECRET_KEY = 'sk_test_abc123'
    MAILCHIMP_API_KEY = 'abc123-usX'
    MAILCHIMP_LIST_ID = '1234'

Of course you should generate your own secret key and use a more secure password for your database. If you like, you can override more of Django settings here. If you do not create this file, you will get a cbsettings.exceptions.NoMatchingSettings exception when starting the server.

With everything installed and all files in place, you may now create the database tables and collect static files. You can do this with:

$ poetry run python migrate
$ poetry run python collectstatic


In the production environment, you'll need to create a different dev settings configuration file. It will be similar to the one above, except that you will be using production keys and secrets instead of development keys. In addition, you will need to create a file, similar to your file, but this one will contain settings only relevant to production. This file is a good place to put keys and secrets for services that are only used in the production environment, such as Sentry. It may be best to subclass the DevSettings class you created, in order to get something like this:

from import DevSettings

class ProdSettings(DevSettings):
    DEBUG = False
    ACCEPTABLE_HOSTS = ['', 'localhost',]
    RAVEN_PUBLIC_KEY = 'xyz'
    RAVEN_SECRET_KEY = 'abc123'
    RAVEN_PROJECT_ID = '1234'
    AWS_S3_BUCKET_NAME = 'perdiem-xyz'
    AWS_ACCESS_KEY_ID = '1234'
    AWS_SECRET_ACCESS_KEY = 'abc123'
    AWS_SES_ACCESS_KEY_ID = '1234'
    EMAIL_BACKEND = 'django_ses.SESBackend'
    GA_TRACKING_CODE = 'UA-1234-1'
    JACO_API_KEY = 'abc123'

For reference, the format of the Sentry DSN is as follows:


Alternatively, you may choose to merge your production file into In that case, be sure to subclass BaseSettings instead of DevSettings and make sure all definitions from are in

PerDiem uses Gunicorn with runit and Nginx. You can install them with the following:

$ sudo apt-get install runit nginx

The rest of the README assumes that the PerDiem repo was checked out in /home/perdiem/. Please replace this path as necessary.

We need to copy the Nginx configuration:

$ cd /etc/nginx/sites-enabled
$ sudo ln -s /home/perdiem/perdiem-django/perdiem/perdiem/nginx/

Then we need to create a script to run PerDiem on boot with runit:

$ sudo mkdir /etc/sv/perdiem
$ cd /etc/sv/perdiem
$ sudo nano run

In this file, create a script similar to the following:




if [ -f $PID ]; then rm $PID; fi

cd $ROOT
exec $GUNICORN -c $ROOT/perdiem/ --pid=$PID $APP

Then change the permissions on the file to be executable and symlink the project to /etc/service:

$ sudo chmod u+x run
$ sudo ln -s /etc/sv/perdiem /etc/service/perdiem

PerDiem should now automatically be running on the local machine.

To configure your local machine to enable easier deployments, simply add comma-separated SSH-like "host strings" for all of the production instances to an environment variable called PERDIEM_REMOTE_HOSTS. You may want to add this in your .bashrc or similar. Here is an example of a line in .bashrc that defines two PerDiem production instances:,

Then you will be able to deploy to all of your instances with Fabric, simply with:

$ poetry run fab deploy

If you'd like Fabric to notify your #general Slack channel when deployments complete, you can also add an environment variable PERDIEM_DEPLOYBOT_TOKEN containing the token for a bot configured on Slack:

You can’t perform that action at this time.