Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.5 kB
16
Indexable
In [7]: from exercises_app.models import Album, Band
---------------------------------------------------------------------------
ImproperlyConfigured                      Traceback (most recent call last)
Cell In[7], line 1
----> 1 from exercises_app.models import Album, Band

File ~/Pulpit/Coders Lab/zadania/Blok 2/ONL_PYT_W_29_podstawy_django/project/exercises_app/models.py:16
      3 GENRE = (
      4     (-1, "not defined"),
      5     (0, "rock"),
   (...)
     11     (6, "other")
     12 )
     15 # Create your models here.
---> 16 class Band(models.Model):
     17     name = models.CharField(max_length=64)
     18     year = models.IntegerField(null=True)

File ~/Pulpit/Coders Lab/zadania/Blok 2/ONL_PYT_W_29_podstawy_django/project/venvzad/lib/python3.10/site-packages/django/db/models/base.py:108, in ModelBase.__new__(cls, name, bases, attrs, **kwargs)
    105 app_label = None
    107 # Look for an application configuration to attach the model to.
--> 108 app_config = apps.get_containing_app_config(module)
    110 if getattr(meta, 'app_label', None) is None:
    111     if app_config is None:

File ~/Pulpit/Coders Lab/zadania/Blok 2/ONL_PYT_W_29_podstawy_django/project/venvzad/lib/python3.10/site-packages/django/apps/registry.py:253, in Apps.get_containing_app_config(self, object_name)
    244 def get_containing_app_config(self, object_name):
    245     """
    246     Look for an app config containing a given object.
    247 
   (...)
    251     Return None if the object isn't in any registered app config.
    252     """
--> 253     self.check_apps_ready()
    254     candidates = []
    255     for app_config in self.app_configs.values():

File ~/Pulpit/Coders Lab/zadania/Blok 2/ONL_PYT_W_29_podstawy_django/project/venvzad/lib/python3.10/site-packages/django/apps/registry.py:135, in Apps.check_apps_ready(self)
    130 from django.conf import settings
    132 # If "not ready" is due to unconfigured settings, accessing
    133 # INSTALLED_APPS raises a more helpful ImproperlyConfigured
    134 # exception.
--> 135 settings.INSTALLED_APPS
    136 raise AppRegistryNotReady("Apps aren't loaded yet.")

File ~/Pulpit/Coders Lab/zadania/Blok 2/ONL_PYT_W_29_podstawy_django/project/venvzad/lib/python3.10/site-packages/django/conf/__init__.py:84, in LazySettings.__getattr__(self, name)
     82 """Return the value of a setting and cache it in self.__dict__."""
     83 if self._wrapped is empty:
---> 84     self._setup(name)
     85 val = getattr(self._wrapped, name)
     87 # Special case some settings which require further modification.
     88 # This is done here for performance reasons so the modified value is cached.

File ~/Pulpit/Coders Lab/zadania/Blok 2/ONL_PYT_W_29_podstawy_django/project/venvzad/lib/python3.10/site-packages/django/conf/__init__.py:65, in LazySettings._setup(self, name)
     63 if not settings_module:
     64     desc = ("setting %s" % name) if name else "settings"
---> 65     raise ImproperlyConfigured(
     66         "Requested %s, but settings are not configured. "
     67         "You must either define the environment variable %s "
     68         "or call settings.configure() before accessing settings."
     69         % (desc, ENVIRONMENT_VARIABLE))
     71 self._wrapped = Settings(settings_module)

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.