FAQ

  1. Can django-environ determine the location of .env file automatically?

    django-environ will try to get and read .env file from the project root if you haven’t specified the path for it when call environ.Env.read_env(). However, this is not the recommended way. When it is possible always specify the path tho .env file. Alternatively, you can use a trick with a environment variable pointing to the actual location of .env file. For details see “Multiple env files”.

  2. 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).

  3. What kind of file should .env be?

    .env is a plain text file.

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

    Just .env. However, this is not a strict rule, but just a common practice. Formally, you can use any filename.

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

    No need to import, django-environ automatically picks variables from there.