I keep getting an import error on environ in my settings.py file, I have it installed via poetry in my .venv file as well. Could this be an error outside the settings file possibly?
`
import environ
env = environ.Env(
DEBUG=(bool, False),
ENVIORNMENT=(str, 'PRODUCTION'),
)
environ.Env.read_env()
ENVIRONMENT= env.str('ENVIRONMENT')
SECRET_KEY = env.str('SECRET_KEY')
DEBUG = env.bool('DEBUG')
ALLOWED_HOSTS = tuple(env.list('ALLOWED_HOSTS'))
`
A ModuleNotFoundError is raised when Python cannot successfully import a module. The full error message looks something like this: ModuleNotFoundError: No module named 'your_module_name' This error is encountered when you forget to install a dependency for a project.
Python module is not Installed You can get the issue when you are trying to import a module of a library which not installed in your virtual environment. So before importing a library’s module, you need to install it with the pip command. Let’s import an module (requests) into app.py file which is not installed into our virtual environment:
Maybe your python3 is try to find your script's module in the " /usr/local/lib/python3.x " directory . So if that module is not there then the ModuleNotFoundError: No module named 'dedupe' error is happening .
ModuleNotFoundError: No module named 'your_module_name' This error is encountered when you forget to install a dependency for a project. Because you haven’t installed the dependency, Python does not know where to locate it. ModuleNotFoundErrors come up in user-defined modules.
Make sure that you are using the desired python interpreter, that your virtualenv is setup correctly, and that the desired django-environ is installed within that virtualenv via
(inside venv) pip install django-environ
The problem could occur due to the following reasons:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With