Skip to content

Instantly share code, notes, and snippets.

@japsu
Created April 13, 2017 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save japsu/97a4307cc447652ee90dbd48714b40b5 to your computer and use it in GitHub Desktop.
Save japsu/97a4307cc447652ee90dbd48714b40b5 to your computer and use it in GitHub Desktop.

Regression in django-environ==0.4.2

Value of env.bool('DEBUG') given DEBUG=1 changes between 0.4.1 and 0.4.2. Tested under Python 3.6.

To reproduce:

docker-compose up

Example output:

Starting djangoenvironregression_environ041_1
Starting djangoenvironregression_environ042_1
Attaching to djangoenvironregression_environ042_1, djangoenvironregression_environ041_1
environ042_1  | DEBUG False
environ041_1  | DEBUG True
djangoenvironregression_environ042_1 exited with code 0
djangoenvironregression_environ041_1 exited with code 0
version: '2'
services:
environ041:
build:
context: .
dockerfile: Dockerfile.041
environment:
DEBUG: 1
environ042:
build:
context: .
dockerfile: Dockerfile.042
environment:
DEBUG: 1
FROM python:3.6
RUN pip install django-environ==0.4.1
COPY test.py /usr/src/app/test.py
CMD ["python", "/usr/src/app/test.py"]
FROM python:3.6
RUN pip install django-environ==0.4.2
COPY test.py /usr/src/app/test.py
CMD ["python", "/usr/src/app/test.py"]
import environ
env = environ.Env()
print('DEBUG', env.bool('DEBUG', default=False))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment