docs/quickstart.rst
Create a .env file in project root directory. The file format can be understood
from the example below:
.. code-block:: shell
DEBUG=on SECRET_KEY=your-secret-key DATABASE_URL=psql://user:[email protected]:8458/database SQLITE_URL=sqlite:///my-local-sqlite.db CACHE_URL=memcache://127.0.0.1:11211,127.0.0.1:11212,127.0.0.1:11213 REDIS_URL=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=ungithubbed-secret
And use it with settings.py as follows:
.. include:: ../README.rst :start-after: -code-begin- :end-before: -overview-
The .env file should be specific to the environment and not checked into
version control, it is best practice documenting the .env file with an example.
For example, you can also add .env.dist with a template of your variables to
the project repo. This file should describe the mandatory variables for the
Django application, and it can be committed to version control. This provides a
useful reference and speeds up the on-boarding process for new team members, since
the time to dig through the codebase to find out what has to be set up is reduced.
A good .env.dist could look like this:
.. code-block:: shell
DEBUG=True
ALLOW_ROBOTS=False
SECRET_KEY=secret
ADMINS="John Doe [email protected], Mary [email protected]"
MANAGERS="Blake [email protected], Alice Judge [email protected]"
SERVER_EMAIL=[email protected]