Forums

using django-environ module

Trying to run my settings file i am getting:

File "/home/akrynski/blogonasladowca/blogonasladowca/settings.py", line 15, in <module>
    import environ
ModuleNotFoundError: No module named 'environ'

But the module exists in site-packages

Make sure you run your code in the same virtual environment / python version you installed the packages for.

I do use of python 3.10 and such virtual environment I've created. But when running my settings file i see in the console python v.3.8 is spawn. Don't know why.

OK. I am starting to understand the problem. I've deleted the old environment, created a new one with python3.8, set python3.8 on Web tab and the path to my virtualenv too, installed requirements and reloaded the site. But still after running settings.py I got the same error: module 'environ' is unknown. Besides when I open bash and type which python I am still on the local version, not the virtual. Even after command 'workon myenvironment' nothing changes. And again from the start: because django-environ is installed only to python3.10 site-packages, I reinstalled all to v.3.10. And it works now. So, @pafk was right. Thanks! [SOLVED]

Glad to hear that!