I am using a DRF serializer in my project as below
# my_serrializers.py
from rest_framework import serializers
class TssUpdateExtraVarsSerializer(serializers.Serializer):
cluster_name = serializers.CharField(required=True)
class TssUpdateSerializer(serializers.Serializer):
extra_vars = TssUpdateExtraVarsSerializer(required=True)
It works fine when I send a request and it handles the job.
But if I open a python console (the one in my project's venv) as below:
#python console
from my_serializers import TssUpdateSerializer
s = TssUpdateExtraVarsSerializer(data={"a": 1})
s.is_valid()
I get this error
django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
what is the reason for it and how to fix it.
I want to be able to play with it outside of django. is it possible? how?