django-production-template icon indicating copy to clipboard operation
django-production-template copied to clipboard

Improper Configurations

Open umair313 opened this issue 2 years ago • 0 comments

I get this error when I try to import User Model

(venv) D:\Python\Django\django-production-template\simple>python

Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.contrib.auth.models import User
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\contrib\auth\models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\contrib\auth\base_user.py", line 48, in <module>
    class AbstractBaseUser(models.Model):
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\db\models\base.py", line 108, in __new__
    app_config = apps.get_containing_app_config(module)
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\apps\registry.py", line 253, in get_containing_app_config
    self.check_apps_ready()
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\apps\registry.py", line 135, in check_apps_ready
    settings.INSTALLED_APPS
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\conf\__init__.py", line 82, in __getattr__
    self._setup(name)
  File "D:\Python\Django\django-production-template\venv\lib\site-packages\django\conf\__init__.py", line 63, in _setup
    raise ImproperlyConfigured(
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.
>>>

umair313 avatar Oct 15 '21 08:10 umair313