Skip to main content

Django SECRET_KEY management

Project description

https://travis-ci.org/blinglnav/djangosecretkey.svg?branch=master https://coveralls.io/repos/github/blinglnav/djangosecretkey/badge.svg?branch=master

In Django web framework, it has SECRET_KEY variable in settings.py this variable use to manage credential values like session.

Therefore, SECRET_KEY value have to store outside of settings.py and use this value to read from file or environment variables.

Install

pip instal djangosecretkey

This project has not any dependencies. (For test, needs pytest package) You cannot download yet

Usage

Use file to store secret key

In settings.py

import os
from secret_key import secret_key
# ...
SECRET_KEY = secret_key.from_file(os.path.join(BASE_DIR, 'secret_key'))

If use .from_file() method, you have to secert key file add to .gitignore

Use env to store secret key

In settings.py

import os
from secret_key import secret_key
# ...
SECRET_KEY = secret_key.from_env('env_name')

default env_name is “DJANGO_SECRET_KEY”

Generate secret key manually

You can also generate secret key manually.

import os
from secret_key import secret_key
# ...
SECRET_KEY = secret_key.generate()

But, this method not recommanded.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

DjangoSecretKey-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

DjangoSecretKey-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file DjangoSecretKey-0.1.0.tar.gz.

File metadata

  • Download URL: DjangoSecretKey-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for DjangoSecretKey-0.1.0.tar.gz
Algorithm Hash digest
SHA256 17aae43b852cd04ff92ec247ba908e0d6862b9b054a0fc3aeeaf492dcf2cf4d3
MD5 5c90082fc505de462ba20d702a2f2bfe
BLAKE2b-256 4116ab8239b86b22f84ce2cefddc86637dec4bba317af20eda77454e7aca471a

See more details on using hashes here.

File details

Details for the file DjangoSecretKey-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: DjangoSecretKey-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for DjangoSecretKey-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1570b1a2395194041f30a35f2dcafc0ae21e0b47ef9130d7900fc0de554b66a
MD5 05c768786ffa80090961b69baea28010
BLAKE2b-256 1522018d196d4a41fb63b04d14c4c918b84a7bc636dc5f9423f052454a007894

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page