question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing DJANGO_SETTINGS_MODULE

See original GitHub issue

With empty .coveragerc:

$ coverage run foo/manage.py test bar
[...works...]

With django-coverage-plugin in .coveragerc:

[run]
plugins =
  django_coverage_plugin
$ coverage run foo/manage.py test bar
[...]
django.core.exceptions.ImproperlyConfigured: Requested setting TEMPLATES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

manage.py is unmodified (generated by Django).

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:24 (9 by maintainers)

github_iconTop GitHub Comments

9reactions
GabLeRouxcommented, Oct 16, 2018

I was getting the following error:

django_coverage_plugin.plugin.DjangoTemplatePluginException: Template debugging must be enabled in settings.

I thought I had the setting enabled, but here’s the thing:

The TEMPLATE_DEBUG setting is deprecated in Django 1.8. The new way to do it is described here: https://stackoverflow.com/a/32446043/2319697

DEBUG = True

TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'debug': DEBUG,
        },
    },
]

Error is gone 🎉

0reactions
nedbatcommented, Jun 12, 2016

I opened #25 to deal with the invisible exception.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DJANGO_SETTINGS_MODULE not defined - Stack Overflow
I've tried what some other answers here suggested, but either it's a different problem, or I'm missing something that should be quite obvious....
Read more >
#22559 (Tutorial 5 - Missing few steps in instruction) – Django
You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before acces sing settings. however to execute
Read more >
django-stubs - PyPI
This package contains type stubs and a custom mypy plugin to provide more precise static types and type inference for Django framework. Django...
Read more >
Loading Django settings - missing module : Forums
... project_home) os.environ['DJANGO_SETTINGS_MODULE'] = 'MWC_APP.settings.local_dev'. I am running a virtual env. The casing is all ok.
Read more >
django-configurations 2.4.post5 documentation
and the DJANGO_SETTINGS_MODULE environment variable to the module import path as usual, ... Don't miss the Django project templates pre-configured with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found