Skip to content

graphene_django can't be imported without configuring Django settings #500

Closed
@toolness

Description

@toolness

When starting up a fresh Python interpreter, merely importing graphene_django raises an exception:

>>> import graphene_django
Traceback (most recent call last):
...
django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

While this doesn't seem like that big a deal (and in the grand scheme of things, it really isn't), it does break a few unexpected things. For example, when I ran into some confusing things in the documentation (see #499), I tried examining the source using pipenv:

$ pipenv open graphene_django
Module not found!

This was super confusing, and admittedly might really be a bug in pipenv, but I assume it thought the module wasn't found because of the ImproperlyConfigured exception raised by importing graphene_django.

Anyways, if it's easy to change the package so that its root can be imported without requiring Django settings to be initialized, that would be helpful, but it's probably not really that big a deal if not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions