From 27f9135f53a3cf022f6c8af4d4c96f92e3769840 Mon Sep 17 00:00:00 2001 From: sloria Date: Sun, 22 Jun 2014 12:45:57 -0400 Subject: [PATCH] Get app secret key from environment variable --- {{cookiecutter.app_name}}/README.rst | 10 ++++++++++ .../{{cookiecutter.app_name}}/settings.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.app_name}}/README.rst b/{{cookiecutter.app_name}}/README.rst index aec57ff..dd1d873 100644 --- a/{{cookiecutter.app_name}}/README.rst +++ b/{{cookiecutter.app_name}}/README.rst @@ -8,6 +8,16 @@ Quickstart ---------- +First, set your app's secret key as an environment variable. For example, example add the following to ``.bashrc`` or ``.bash_profile``. + +.. code-block:: bash + + export {{cookiecutter.app_name | upper}}_SECRET = 'something-really-secret' + + +Then run the following commands to bootstrap your environment. + + :: git clone https://github.com/{{cookiecutter.github_username}}/{{ cookiecutter.app_name }} diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/settings.py b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/settings.py index 650a5dc..fe57c51 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/settings.py +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/settings.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- import os +os_env = os.environ class Config(object): - SECRET_KEY = 'shhhh' # TODO: Change me + SECRET_KEY = os_env['{{cookiecutter.app_name | upper}}_SECRET'] # TODO: Change me APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) BCRYPT_LOG_ROUNDS = 13