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
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.
try python manage.py shell
instead of python
in terminal for interactive environment.
try this in your xx.py
from youprojectName.wsgi import *
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
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).