Get app secret key from environment variable

master
sloria 11 years ago
parent 7c320a1e98
commit 27f9135f53
  1. 10
      {{cookiecutter.app_name}}/README.rst
  2. 3
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/settings.py

@ -8,6 +8,16 @@
Quickstart 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 }} git clone https://github.com/{{cookiecutter.github_username}}/{{ cookiecutter.app_name }}

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
os_env = os.environ
class Config(object): 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 APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir)) PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
BCRYPT_LOG_ROUNDS = 13 BCRYPT_LOG_ROUNDS = 13

Loading…
Cancel
Save