Как определить переменную окружения DJANGO_SETTINGS_MODULE?

Я пытаюсь применить chainedForeignKey с помощью https://django-smart selects.readthedocs.io/en/latest/installation.htmland я получил следующую ошибку :

`
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.
`

ваш текст``from django.db import models ваш текстfrom smart_selects.db_fields import ChainedForeignKey

Создавайте свои модели здесь.

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')

Вернуться на верх