ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured

后端 未结 5 1743
别跟我提以往
别跟我提以往 2021-02-07 06:58

I\'m trying to make MongoDB and Django get on with each other the way I want them to. That\'s the error I\'m getting when trying to import viewsets from rest_framework_mongoengi

相关标签:
5条回答
  • 2021-02-07 07:29

    Run python manage.py shell instead of running python to reach environment shell in your project. Python does not simply recognize django installed apps by default.

    0 讨论(0)
  • 2021-02-07 07:33

    try python manage.py shell instead of python in terminal for interactive environment.

    0 讨论(0)
  • 2021-02-07 07:47

    try this in your xx.py

    from youprojectName.wsgi import *

    0 讨论(0)
  • 2021-02-07 07:48

    If you are using windows run

    set DJANGO_SETTINGS_MODULE= <yourProjectName>.settings
    

    (or) navigate to the folder containing settings file in terminal and run

    set  DJANGO_SETTINGS_MODULE=settings
    
    0 讨论(0)
  • 2021-02-07 07:50

    Most common cause of this is that you're just running python instead of using python manage.py shell, which means you need to manually set the DJANGO_SETTINGS_MODULE environment variable so Django knows where to find your settings (manage.py shell does that for you automatically).

    It's also possible (but less common) that you have something that's trying to import settings during the process of setting up your settings. To determine if that's the case, look at your settings file for any imports or function calls that might need to access settings (including code in things being imported by your settings file).

    0 讨论(0)
提交回复
热议问题