used this command to create module - python manage.py startapp todos

getting this error:

Traceback (most recent call last): File "manage.py", line 17, in "Couldn't import Django. Are you sure it's installed and " 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?

please tell me how to solve


I'm not sure, but installation of python-django package may help:

sudo apt-get install python-django

It's a good idea to create django projects in isolated environments, called virtualenvs. To get one type:

sudo apt install python-pip

to get pip. Then:

pip install virtualenv
virtualenv env-name -p python
source env-name/bin/activate

You should be seeing that your prompt has (env-name) in it.

Now you can install django:

pip install django

If you have firther problems refer to django docs.

  • 1
    @karel didn't notice. Changed that to match proper pytthon version – gonczor Jan 9 '18 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.