I keep getting the error "ModuleNotFoundError: No module named 'environ' in my settings.py file". I have installed the dependency in my python shell
14,066
Solution 1
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
Solution 2
The problem could occur due to the following reasons:
- You are using. Virtual environment, but you installed module outside the virtual environment.
- You haven't added 'environ', in your your settings.py file in INSTALLED_APPS.(based on its reference exceptionally not required for this package!)
Author by
Admin
Updated on June 15, 2022Comments
-
Admin almost 2 years
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')) `