encode / django-rest-framework

Web APIs for Django. 🎸
https://www.django-rest-framework.org
Other
28.12k stars 6.81k forks source link

Using Serializers without requiring `django.configure()` #3665

Closed rocktavious closed 8 years ago

rocktavious commented 8 years ago

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.
tomchristie commented 8 years ago

Yup, working towards this.

rocktavious commented 8 years ago

Great! Loving DRF so far. Using it to build another framework for django to similfy integration with Amazon Echo's (Alexa Skills Kit) and it working out great! Thanks for all your hardwork on this package!