How to define the environment variable DJANGO_SETTINGS_MODULE?

I am trying to chainedForeignKey using https://django-smart selects.readthedocs.io/en/latest/installation.htmland i got following error :

`
django.core.exceptions.ImproperlyConfigured: Requested setting USE_DJANGO_JQUERY, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
`

your text``from django.db import models your textfrom smart_selects.db_fields import ChainedForeignKey

Create your models here.

your textclass City(models.Model): your textname = models.CharField(max_length = 25, null = True)

your textclass Area(models.Model): your textname = models.CharField(max_length = 25, null = True) your textcity = models.ForeignKey(City, on_delete = models.CASCADE)

your textclass Store(models.Model): your textstore = models.CharField(max_length = 50) your textcity = models.ForeignKey(City, on_delete = models.CASCADE) your textarea = ChainedForeignKey(Area, chained_field='city', chained_model_field= 'city')

Back to Top