Python Forum

Full Version: After using models.Model on my class Im getting 'ImproperlyConfigured' error Django
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This question is not only about Python but about Django framework as well.

1. I just started a new project in django, I run the command 'django-admin startproject + project_name', and 'python manage.py startapp + app_name'.
It creates a project and app.

1. I also added my new app to the settings:[Image: aMIpy.png]

2.After that I tried to create my first module on 'modules.py' file on my app, but when I do it and run the file, it gives me this error message:[Image: LX3n1.png]

The entire error message says: " 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. "

I created a few projects before, and never saw this problem.

I discovered that if I dont use the 'models.Model' on my class, it does not gives me this error.[Image: v5Dg2.png]

Someone knows what it is about? I didnt change anything on settings file, just added the app name. Maybe its normal to have this error message, when we run the 'modules.py' file, and we should just ignore it?

Thank you!
Try running python manage.py makemigrations and python manage.py migrate