1
I’m a beginner in Python and I’m doing the Django tutorial and using Pycharm as IDE. When I run the command from the internal Pycharm console:
from polls.models import Question
it returns me the following error:
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 would like some help from the community of how I could solve it. Remembering that it is only in Pycharm, when I execute the commands by prompt DOS works.
Grateful for the fixes, I’m new to the community!
– Marley Oliveira
Hello Marley, All quiet? You added the app "polls" in Settings.py in "INSTALLLED_APPS"?
– Victor Fernandes
Hello Victor! Yes, I added, it stayed: 'polls.apps.Pollsconfig' inside the Settings
– Marley Oliveira
The application works well, but inside the DOS. When I try to use the application inside Pycharm, through the internal Console it presents the error.
– Marley Oliveira
Marley, in INSTALLED_APPS, you must inform the way to the app polls, in this case, just leave "apps.polls". About Pycharm, are you using virtualenv? If this is the case, you will need to inform Pycharm which interpreter it should use, by default it pulls the general installation of Python, but if you use virtualenv, you will need to inform the path of the python.exe file inside virtualenv.
– Victor Fernandes