use env variable for django secret key

This commit is contained in:
Floriel Fedry 2021-12-13 12:39:35 +00:00
parent 4daf1c57f7
commit 0ac83b6c09
2 changed files with 4 additions and 3 deletions

View File

@ -13,5 +13,6 @@ Python 3x, pip, Django, Postgresql
3. Go to your charts storage folder and run `pip install -r requirements.txt`. Unix users : you have to have python-dev package to install `psycopg2`.
4. Create an empty database in Postgres (using either command line or `pgadmin`). Go to `charting_library_charts` folder and set up your database connection in `settings.py` (see `DATABASES` @ line #12).
5. Run `python manage.py migrate`. This will create database schema without any data.
6. Run `python manage.py runserver` to run *TEST* instance of your database. Use some other stuff (i.e., Gunicorn) for your production environment.
6. Generate a secret key by running `python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'`
7. Set your secret key to your environment variables `export SECRET_KEY='...'`
8. Run `python manage.py runserver` to run *TEST* instance of your database. Use some other stuff (i.e., Gunicorn) for your production environment.

View File

@ -83,7 +83,7 @@ STATICFILES_FINDERS = (
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'c5-%u0l1*(dj@u33!5*o_gtti0)kkh$m%i#@!(!$d%779kaa&b'
SECRET_KEY = os.getenv('SECRET_KEY', 'c5-%u0l1*(dj@u33!5*o_gtti0)kkh$m%i#@!(!$d%779kaa&b')
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (