From 46051a77264dbe23e26ff3a5638b13c964c96496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20Barrobe=CC=81s?= Date: Thu, 5 Mar 2015 13:25:06 +0100 Subject: [PATCH] Heroku setup documented and managed via env vars --- docs/heroku-bootstrap.md | 31 +++++++++++++++++++++++++++++++ ployst/settings/heroku.py | 12 ++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 docs/heroku-bootstrap.md diff --git a/docs/heroku-bootstrap.md b/docs/heroku-bootstrap.md new file mode 100644 index 0000000..c4e886b --- /dev/null +++ b/docs/heroku-bootstrap.md @@ -0,0 +1,31 @@ +# Bootstrapping ployst in Heroku + +## In Github + +Create an application entry in Github. + + https://github.com/settings/applications/ + +Callback URL: http://ployst.com/github/oauth-confirmed/ + +Copy client ID and client secret to use as `GITHUB_CLIENT_ID` and +`GITHUB_CLIENT_SECRET`. + +## In ployst + +Go to admin and create an API token, label github. +Copy the token to use as `GITHUB_CORE_API_TOKEN` + +## In Heroku + +Go to ployst settings page: + + https://dashboard.heroku.com/apps/ployst/settings + +Reveal config vars. Add/set values for the following: + + GITHUB_CORE_API_TOKEN + GITHUB_CLIENT_ID + GITHUB_CLIENT_SECRET + +All these can also be set via `heroku config`. diff --git a/ployst/settings/heroku.py b/ployst/settings/heroku.py index b6f8342..617c8d1 100644 --- a/ployst/settings/heroku.py +++ b/ployst/settings/heroku.py @@ -1,5 +1,8 @@ +from os import getenv + from .base import * # noqa + # Parse database configuration from $DATABASE_URL import dj_database_url DATABASES['default'] = dj_database_url.config() @@ -17,3 +20,12 @@ # http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html DEBUG = True + +CORE_API_ADDRESS = "http://localhost:80/" + +# The API token created in admin for 'github' +GITHUB_CORE_API_TOKEN = getenv('GITHUB_CORE_API_TOKEN') + +# The application OAUTH settings from github.com/ applications +GITHUB_CLIENT_ID = getenv('GITHUB_CLIENT_ID') +GITHUB_CLIENT_SECRET = getenv('GITHUB_CLIENT_SECRET')