0

After i run python3 manage.py runserver i get the following error:

Traceback (most recent call last): File "manage.py", line 11, in main from django.core.management import execute_from_command_line File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/django/core/management/init.py", line 12, in from django.conf import settings ImportError: cannot import name 'settings' from 'django.conf' (unknown location)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 13, in main
    raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
(nova_venv) Luiss-MacBook-Pro:novadjango luiseduardo$ pip install django
Traceback (most recent call last):
  File "/Users/luiseduardo/Practice/nova/nova_venv/bin/pip", line 6, in <module>
    from pip._internal import main
  File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/pip/_internal/__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/pip/_vendor/urllib3/__init__.py", line 7, in <module>
    from .connectionpool import (
  File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/pip/_vendor/urllib3/connectionpool.py", line 30, in <module>
    from .connection import (
ModuleNotFoundError: No module named 'pip._vendor.urllib3.connection'

Im using mac and i do have my virtualenv activated.

levb92
  • 1

2 Answers2

0

I had the same issue and this solved for me: pip install --upgrade pip

JoeFrank
  • 71
  • 8
  • Thank you Joao. I ended up cloning a previous branch and creating a new project since nothing worked for me. – levb92 Apr 12 '21 at 19:25
0

Go to virtual env by following command: .\<your virtual env name>\Scripts\activate
and type pip list. If you didn't saw django, please install django by: pip install django
If you still get this error or new one please edit post and put your setting.py source. Thanks

Mohammad Nazari
  • 137
  • 1
  • 12