Skip to content

Using Serializers without requiring django.configure() #3665

@rocktavious

Description

@rocktavious

Seems like the DRF serializers could be used outside of django (much like the marshmallow framework) but when you try to import the serializers (cuz i was trying to test something with them) you get an error like so. Seems like this could be fixed so the serializers can be tested in the raw python interpreter.

  Python Shell, prompt 2, line 1
  File "/Users/krockman/Projects/.virtualenv/home/lib/python2.7/site-packages/rest_framework/serializers.py", line 18, in <module>
    from rest_framework.compat import (
  File "/Users/krockman/Projects/.virtualenv/home/lib/python2.7/site-packages/rest_framework/compat.py", line 107, in <module>
    if 'guardian' in settings.INSTALLED_APPS:
  File "/Users/krockman/Projects/.virtualenv/home/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/Users/krockman/Projects/.virtualenv/home/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions