DJANGO error: Django.core.exceptions.Improperlyconfigured in the initial tutorial!

Asked

Viewed 278 times

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!

  • Hello Marley, All quiet? You added the app "polls" in Settings.py in "INSTALLLED_APPS"?

  • Hello Victor! Yes, I added, it stayed: 'polls.apps.Pollsconfig' inside the Settings

  • 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, 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.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.