0

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

2 Answers 2

1

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

sudo apt-get install python-django
1
  • wow super... its working Jan 9, 2018 at 9:51
1

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
  • 1
    @karel didn't notice. Changed that to match proper pytthon version
    – gonczor
    Jan 9, 2018 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .