Проблема с запуском Python console в Pycharm community (django)

Python console

from products.models import ProductCategory

ошибка: 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.

вот models.py

from django.db import models

        class  ProductCategory(models.Model):
        name = models.CharField(max_length=128, unique=True)
        description = models.TextField(null=True, blank=True)

       class Product(models.Model):
       name = models.CharField(max_length=256)
       description = models.TextField()
       price = models.DecimalField(max_digits=6, decimal_places=2)
       quantity = models.PositiveIntegerField(default=0)
       image = models.ImageField(upload_to='products_images')
       category = models.ForeignKey(to=ProductCategory, on_delete=models.CASCADE)

полный traceback

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