where/when should env.sample (.env) be pulled in? Is this a bug?

398 views Asked by At

I was sourcing .env through my shell, which, I suspect, is a non-standard behavior, because this struck me as a bug:

DJANGO_SECRET_KEY=string

along with all the other variables are not quoted with single-apostrophe ticks ' ... which means that if there are characters that can be shell-evaluated, they will be. This also affects urls because of the & that may be possible in their strings, as well as other shell characters.

Shouldn't it be

DJANGO_SECRET_KEY='string'

?

Or am I doing it wrong .env never gets sourced by a shell?

2

There are 2 answers

0
Paul T. On

The .env file is read by the package django-environ and bears no relationship to either the python or shell formatting, it literally wants <key>=<value>.

0
sfdye On

Yes, the .env file is meant to be consumed by the django-environ package.

For detailed usage, check out the GitHub repo.