From 9037bcb9223061de77519711c312ce09f71d5ded Mon Sep 17 00:00:00 2001 From: Sunil Kumar Date: Thu, 27 Aug 2015 08:40:16 +0530 Subject: [PATCH] Add Django SECRET_KEY in graphite settings --- README.md | 3 +++ graphite/local_settings.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index c017c0e..a7c34d9 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ recommended) you can use docker's data volumes feature. For example, to store graphite's metric database at `/data/graphite` on the host, you could use: docker run -v /data/graphite:/var/lib/graphite/storage/whisper \ + -e SECRET_KEY='random-secret-key' \ -p 80:80 \ -p 3000:3000 \ -p 2003:2003 \ @@ -48,6 +49,8 @@ resulting in whisper files of approximately 2.5MiB. ### Getting started +Generate your SECRET_KEY from [here](http://www.miniwebtool.com/django-secret-key-generator/). It is optional but highly recommended. + **Fill in the blanks** in supervisord.conf before building the image, otherwise Google auth will not work. You will need to register an app on google see: https://github.com/bitly/google_auth_proxy for more details PR welcome to improve this config. diff --git a/graphite/local_settings.py b/graphite/local_settings.py index 7827d11..90539a9 100644 --- a/graphite/local_settings.py +++ b/graphite/local_settings.py @@ -1,4 +1,12 @@ # Edit this file to override the default graphite settings, do not edit settings.py +from os import environ + +# Set SECRET_KEY if passed in via environment variable +try: + if environ['SECRET_KEY']: + SECRET_KEY = environ['SECRET_KEY'] +except KeyError: + pass # Turn on debugging and restart apache if you ever see an "Internal Server Error" page #DEBUG = True