Problems running VirtualEnv under Windows.

A

ashconnor

Hello,

After reading 'Practical Django Projects' I decided that I want to
implement the VirtualEnv tip suggested in order to properly segregate
code/modules in different projects. I am however having problems with
my django installations not using site-packages within the virtualenv
but rather attempting to use site-packages in the default python
installation directory.

Recreating the problem:

1) Install Python 2.7 via the Windows installer. Add C:/Python27;C:/
Python27/Scripts to Windows PATH.
2) Install setuptools-0.6c11-py2.7.egg via the Windows installer.
3) Install VirtualEnv through `pip install virtualenv`
4) Create an VirtualEnv via `virtualenv --no-site-packages MyEnvName`
5) Activate VirtualEnv via `../MyEnvName/Scripts/activate.bat`
6) Install django via `pip install django`
7) Run django-admin.py startproject ProjectName
8) Error results stating django.core module does not exist.

NB: This error will not occur if django is installed in your root
directory.
NB2: Running the Python interpreter in active VirtualEnv to print the
sys.path shows the correct paths. Which has just futher added to my
confusion.

I'd appreciate any insight or troubleshooting assistance.

Thanks

Ash
 
A

ashconnor

I've resolved this issue by deleting the *.py file association in
Windows.

You can do this either by associating *.py with something like
textpad, using a utility such as http://defaultprogramseditor.com/ or
doing so in the registry.

Note that when using the command like you need to issue commands with
a preceding `python` keyword.

For example in a normal installation enviroment the following is
possible `django-admin.py startproject MyProject`, however in a
VirtualEnv with *.py associations removed one must do `python django-
admin.py startproject MyProject` otherwise Windows will attempt to
open the file in the default application even if there isn't one.

Thanks,

Ash
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top