django.core.exceptions.ImproperlyConfigured: Requested setting MPTT_DEFAULT_LEVEL_INDICATOR, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing setting

11 views
Skip to first unread message

Roger Reyes

unread,
Jan 16, 2024, 1:47:19 AMJan 16
to django-mptt-dev
Hello how are you? I am creating an Ecommerce and I am using Django-MPTT for the hierarchy in my model for the categories, I am also using pytest, and when I try to run the tests I get this error:
django.core.exceptions.ImproperlyConfigured: Requested setting MPTT_DEFAULT_LEVEL_INDICATOR, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

I made sure that all the settings in my settings were correct, but the error still persists. Has anyone had something similar happen to them?

James Beith

unread,
Jan 17, 2024, 12:36:03 AMJan 17
to django-mptt-dev
You'll likely want to also use the pytest-django package too and then configure the Django settings using one of these approaches:


James

Roger Reyes

unread,
Jan 17, 2024, 1:47:18 AMJan 17
to django-...@googlegroups.com
Excellent, I was able to solve the problem with the following command to run the tests: DJANGO_SETTINGS_MODULE=nameapp.settings pytest. Thank you Jaime!

--
You received this message because you are subscribed to the Google Groups "django-mptt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-mptt-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-mptt-dev/7bc5b5c1-d2bf-4672-90cf-bdb648e41483n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages