[Answer]-Terminal/django/komodo edit

1👍

Let’s start from the beginning:

  1. You are in your project folder eg /home/me/myproject
  2. You create a new virtualenv, eg virtualenv /home/me/virtualenvs/myprojectenv
  3. You activate the new virtualenv:
    source /home/me/virtualenvs/myprojectenv/bin/activate
    …this means that python and pip commands now point to the versions installed in your virtualenv
  4. You install your project dependencies pip install django
  5. You can ./manage.py runserver successfully

Now, the virtualenv has only been activated in your current terminal session. If you cd outside your project directory the virtualenv is still active. But if you open a new terminal window (or turn off the computer and come back later) the virtualenv is not activated.

If the virtualenv is not activated then the python and pip commands point to the system-installed copies (if they exist) and Django has not been installed there.

All you need to do when you open a new terminal is step 3. above:

source /home/me/virtualenvs/myprojectenv/bin/activate

Possibly the tutorial you followed got you to install virtualenvwrapper which is an additional convenience layer around the virtualenv commands above. In that case the steps would look like this:

  1. You are in your project folder eg /home/me/myproject
  2. You create a new virtualenv, eg mkvirtualenv myprojectenv
    …virtualenv has already been activated for you now!
  3. You install your project dependencies pip install django
  4. You can ./manage.py runserver successfully

and whenever you start a new shell session you need to:

workon myprojectenv

in order to re-activate the virtualenv

Leave a comment