0

I am using python 3 and never installed python 2 on this PC. Trying to install and use Django. I was trying to use pip to download it but when I enter pip install django==1.8 on my command line, nothing happens. No error messages, no further information. Command line just seems to freeze.

I checked if my pip was installed by running import pip on my python shell and able to do it. I ended up downloading django and installing it via a .gz file. For checking, I tried using the python shell and able to import django.

I have now created a virtual environment and activated it and my command line looks as follows now:

(myenv) c:/....... thus am in my virtual environment.

I started a new project in using django-admin startproject mysite .

The mysite folder is created alone with a manage.py file.

Next up when I try to run the command python manage.py migrate , I get the following error:

from django.core.management import execute_from_command_line
ImportError: No module name 'django'

My manage.py file header is correct with the following line - #!/usr/bin/env python

Am I supposed to install django again in each individual virtual environment I create? If yes how do I do it since pip is jamming up.

Am I supposed to mess with environment variable PATH for this? Can someone help please. Went through similar cases here and none is helping.

cubeb
  • 557
  • 1
  • 5
  • 18

1 Answers1

0

Am I supposed to mess with environment variable PATH for this?

No.

Am I supposed to install django again in each individual virtual environment I create?

Yes.

If yes how do I do it since pip is jamming up?

Even if you develop in Windows, it is really good practice to keep your environment in a linux virtual machine, and use bash scripts to prepare it, so if something goes unexpected, you can easily destroy it and spin it up again. One way of doing so is installing VirtualBox + Vagrant.

One example of bash script is here: https://github.com/torchbox/vagrant-django-template

See the Vagrantfile, and etc/install.sh. Hope that helps.

mehmet
  • 7,720
  • 5
  • 42
  • 48