From: ashconnor on
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
From: ashconnor on
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

On Jul 12, 1:55 am, ashconnor <ash.con...(a)gmail.com> wrote:
> 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