I can create a project with django-admin.py startproject
within a virtualenv. But when I try to run server with python manage.py runserver
, I get an error:
(check)robin@robin-VirtualBox:~/checking$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
But I can run the server when I deactivate the environment and run the it from the project directory. Please help how to solve this. Thank you.
(check)robin@robin-VirtualBox:~/checking$ pip freeze
argparse==1.2.1
wsgiref==0.1.2
Maybe the Django has lost some plugin with pip, so we can install Django with Tarball:
install it.
Most likely, you have not installed django in the virtual environment.
Either install django in virtual environment. Activate the environment and then install django using
pip
or other methods.Or link/copy django installed on the system (somewhere in
/usr/lib/python-XXX
) to python site packages in the environment. No recommended.from the output of
pip freeze
you don't haveDjango
installed in your virtual environmentrun
pip install django