Skip to content

[bug][DJANGO] settings.DEBUG doesn't work like expected #703

@barrachri

Description

@barrachri

Describe the bug

Hi! I am testing out django with dynaconf, I followed the readme (https://www.dynaconf.com/django/#importing-settings-directly-recommended-for-the-above-case) and the first thing I am trying is to change the DEBUG value depending on the env.

But it doesn't work, and I keep getting False.

To Reproduce

my settings.py

from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = (
    "my-secret-key"
)

DEBUG = True

# HERE STARTS DYNACONF EXTENSION LOAD (Keep at the very bottom of settings.py)
# Read more at https://dynaconf.readthedocs.io/en/latest/guides/django.html
import dynaconf  # noqa

settings = dynaconf.DjangoDynaconf(__name__)  # noqa
# HERE ENDS DYNACONF EXTENSION LOAD (No more code below this line)

assert settings.DEBUG is True

my settings.yaml

default:
  ALLOWED_HOSTS:
      - '*'
production:
  DEBUG: true
  ALLOWED_HOSTS:
    - 'server.prod.com'

Expected behavior

Ideally DEBUG should be true.

Environment (please complete the following information):
OS X
Django = "^4.0"
dynaconf = {extras = ["yaml"], version = "^3.1.7"}

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Not a BugNot a Problem, expected behavior

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions