djangopython-decouple

Creating .env file on the root of the project


I am trying to download a Django project from github and one of the requirements is:"As the project uses python-decouple you will need to create a file named .env on the root of the project with three values, as following:

DEBUG=True
SECRET_KEY='mys3cr3tk3y'
DATABASE_URL='postgres://u_bootcamp:p4ssw0rd@localhost:5432/bootcamp

"

1.What(where) is the root part of the project, is it part of the project where are settings?

2.What kind of file should .env be?(python package I suppose)

3.Should name of the file be simply .env(or something.env)?

4.Is .env file going to be imported in settings file?


Solution

    1. What(where) is the root part of the project, is it part of the project where are settings?

      • Where your manage.py file is (that is your project root directory).
    2. What kind of file should .env be? (python package I suppose)

      • .env is a text file not a package.
    3. Should name of the file be simply .env (or something.env)?

      • Just .env
    4. Is .env file going to be imported in settings file?

      • No need to import, python-decouple automatically picks variables from there.

    Read more about Where the settings data are stored? and Usage of python-decouple.