Feb-09-2020, 05:15 PM
Hello,
I'm trying to play around with the Django tutorial in the Django website, but I ran into an error and don't understand why I am getting it. I found some info about it in other forums, but the answers talk about setting a virtual environment or adding it to the PYTHONPATH environment variable. I still don't understand virtual environments and I'm trying to run this example without it—probably I'll learn and use one soon—and I have django in the following directory "C:\Users\Ivan\Anaconda3\pkgs\python-3.7.0-hea74fb7_0\Lib\site-packages". Isn't this directory supposed to be correct for python to import Django?
This is the exact command I'm using and the exact error I'm getting:
I'm trying to play around with the Django tutorial in the Django website, but I ran into an error and don't understand why I am getting it. I found some info about it in other forums, but the answers talk about setting a virtual environment or adding it to the PYTHONPATH environment variable. I still don't understand virtual environments and I'm trying to run this example without it—probably I'll learn and use one soon—and I have django in the following directory "C:\Users\Ivan\Anaconda3\pkgs\python-3.7.0-hea74fb7_0\Lib\site-packages". Isn't this directory supposed to be correct for python to import Django?
This is the exact command I'm using and the exact error I'm getting:
!python manage.py runserver
Output:Traceback (most recent call last):
File "manage.py", line 10, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 16, in main
) from exc
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?
Thanks in advance.