pip install
python manage.py runserver
it gives me an error.
pip install djangodjango-admin startapp
Here you can see that Django is installed : #
**C:\Users\Kampet\Desktop\Python-Django\mysite>pip install django Requirement already satisfied: django in c:\users\kampet\appdata\local\programs\ python\python37-32\lib\site-packages (2.2.4) Requirement already satisfied: pytz in c:\users\kampet\appdata\local\programs\py thon\python37-32\lib\site-packages (from django) (2019.2) Requirement already satisfied: sqlparse in c:\users\kampet\appdata\local\program s\python\python37-32\lib\site-packages (from django) (0.3.0)**
# And thats my error
**C:\Users\Kampet\Desktop\Python-Django\mysite>python manage.py runserver
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 o
n your PYTHONPATH environment variable? Did you forget to activate a virtual env
ironment?**
###################
Here is where my virtual environment is located.
Python-Django
-----------------mysite
-------------------------main
-------------------------mysite
-------------------------manage.py
-----------------venv
-------------------------Include
-------------------------Lib
-------------------------Scripts
-------------------------pyvenv.cfg
This is my manage.py:
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise 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?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
#
I don't know why it can't find the module "django" / django.core.management I also can't find django.core.management anywhere in my files, but I reinstalled and upgraded django several times. I don't know if this helps you.
Thank you for your time.