Re: Pre-populating data in the admin panel

2014-02-03 Thread kerviel patrice


Le vendredi 31 janvier 2014 09:22:46 UTC+1, kerviel patrice a écrit :
>
> In the Django Admin I want to populate fields for a foreign key record 
> when I click the add (+) button
> I tried with formfield_for_foreignkey but it does not work
>
> model
>
> class Property(models.Model):
> name = models.CharField(_('name'), max_length=50)
> description = models.TextField(_('description'), blank=True)
>
>
> class Physic(models.Model):
> name = models.ForeignKey(Property, verbose_name=_('name'), null=True, 
> blank=True,)
> lapropriete = models.CharField(_('property'), max_length=100)
>
>
> class UniteProperty2(models.Model):
> name = models.ForeignKey(Material, verbose_name=_('name'))
>  
> nature_unit = models.ForeignKey(Property, verbose_name=_('category')) 
>   
> choix = models.ForeignKey(Physic, verbose_name=_('properties'), 
> null=True, blank=True,  related_name='UniteProperty2_choix') 
>
>
> forms
>
> def formfield_for_foreignkey(self, db_field, request, **kwargs):
>  
>  
> if request.user.is_superuser:
> if db_field.name == 'nature_unit':
> qs = Property.objects.all()
> for index in enumerate(qs):
> print 'index', index
> kwargs['initial'] = qs
>
>  
> return db_field.formfield(**kwargs)
>  
> if db_field.name == 'choix':
> qs1 = Physic.objects.all()
> for index in enumerate(qs1):
> print 'index', index
> kwargs['initial'] = qs1
> return db_field.formfield(**kwargs)
>  
>  
> return super(UniteProperty2Inline, 
> self).formfield_for_foreignkey(db_field, request, **kwargs)
>
> 
> and index :
>

index (0, )
index (1, )
index (2, )
index (3, )
index (4, )
index (5, )


index (0, )
index (1, )
index (2, )
index (3, )
index (4, )
index (5, )
index (6, )
index (7, )
index (8, )
index (9, )
index (10, )
index (11, )
index (12, )
index (13, )
index (14, )
index (15, )
index (16, )
index (17, )
index (18, )

I just want each category is associated has a property 

a pre-Chosen dropdown on 'Mechanical' has an associated pre-Chosen dropdown 
on vickers hardness and Aunsi on 

13 or drop-down lists for categories and 13 for properties


how to do ?? 

>
> 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ddc0f923-02f0-466f-b800-c41c5f097763%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: djangopackages certificate

2014-02-03 Thread Mike Dewhirst

On 3/02/2014 4:40pm, Russell Keith-Magee wrote:


On Mon, Feb 3, 2014 at 12:49 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote:

Just visited https://www.djangopackages.__com/
 and got a "certificate expired"
warning.


Hi Mike,

Danny tweeted about this problem this morning; apparently the
certificate was autorenewed, but they missed the notification email. He
didn't say when he would get the problem fixed, but he's at least aware
of it.


Didn't look too ominous so I threw caution to the wind anyway :)

Mike



Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAJxq84-1g0pfYNc6%2B-hsDmOd6P6RhhefZTsNm1hbRkPw0dBMpA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52EF642A.9010106%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread Mike Dewhirst

On 29/01/2014 7:10pm, Sam Lai wrote:

Oops, my memory failed me. They don't work with pip, but they do work
with easy_install, which virtualenvs have as well (at least mine do).

http://stackoverflow.com/a/5442340/150999

For example,

easy_install C:\Users\sam\Downloads\Pygments-1.6.win-amd64-py2.7.exe


Yes - that works. I have now reworked reality into a complex 
interlocking web of batch scripts which would be embarrassing to show.


However, this evening at the Melbourne PUG meeting I heard about 
Anaconda which apparently make virtualenv passé. Haven't looked at it 
yet. Might be a day or so ...


Cheers

Mike





On 29 January 2014 16:27, Mike Dewhirst  wrote:

On 29/01/2014 2:23pm, Sam Lai wrote:


However, even after downloading from that site they cannot be installed
manually into a virtualenv! Only pip can do that.



You can install the packages from
http://www.lfd.uci.edu/~gohlke/pythonlibs/ by simply running -

pip install 



I did try that earlier but had no luck. Maybe I got the incantation wrong?

(proj-x) C:\users\miked\env\proj-x>pip install
C:\install_kits\python\postgresql\psycopg2-2.4.5.win32-py2.7.exe

Exception:
Traceback
...
ValueError: ('Missing distribution spec',
'\\install_kits\\python\\postgresql\\psycopg2-2.4.5.win32-py2.7.exe')

Mike




... from inside your virtualenv. Those .exe files are pip-compatible
ZIP archives

On 29 January 2014 13:56, Mike Dewhirst  wrote:


A little while ago I suggested to someone using Windows to implement
virtualenv "later". So I thought I'd document my experience here.

In summary, it probably works well if you have Visual Studio. The process
outlined below shows a clumsy workaround if you don't.

Hope it helps someone

Mike

- - - - - -

$pip install virtualenv # first step (requires pip obviously)

$mkdir c:\users\miked\env

$virtualenv --no-site-packages c:\users\miked\env\proj-x
New python executable in c:\users\miked\env\proj-x\Scripts\python.exe
Installing setuptools, pip...done.

Now copy your "myproject-x" into c:\users\miked\env\proj-x\myproject-x

At this point on Linux one would install virtualenv-wrapper but that is
unfortunately not available for Windows so a simple workaround is ...

1. mkdir \users\miked\bin # could be anything eg \users\miked\bat

2. Add C:\users\miked\bin to the path environment variable

3. Create a batch file called C:\users\miked\bin\proj-x.bat containing:

cd \users\miked\env\proj-x\myproject-x
..\Scripts\activate

4. Create another batch file
C:\users\miked\env\proj-x\myproject-x\exit.bat
containing:

cd \users\miked\
\users\miked\env\proj-x\Scripts\deactivate

5. Test the workaround by opening a command prompt somewhere and entering
proj-x. You should see:

C:\Documents and Settings\Mike Dewhirst\Desktop>cd
\users\miked\env\proj-x\myproject-x

C:\users\miked\env\proj-x\myproject-x>..\Scripts\activate
(proj-x) C:\users\miked\env\proj-x\myproject-x>

6. Test the exit batch file by entering exit at that command prompt:

C:\users\miked\env\proj-x\myproject-x>..\Scripts\activate
(proj-x) C:\users\miked\env\proj-x\myproject-x>exit

(proj-x) C:\users\miked\env\proj-x\myproject-x>cd \users\miked\

(proj-x) C:\users\miked>\users\miked\env\proj-x\Scripts\deactivate
C:\users\miked>

This should let you get into and out of the virtualenv quite easily.

Now comes the difficult bit for Windows - installing stuff in the new
Python's site-packages. First, though, discover what you already have
installed in your main site-packages:

pip freeze > requirements.txt  # lists existing site-packages

Here is mine, most of which I don't want in proj-x

Django==1.5.4
Jinja2==2.7.1
MarkupSafe==0.18
Pygments==1.6
South==0.7.6
Sphinx==1.1.3
coverage==3.7
django-discover-runner==1.0
docutils==0.9.1
filemov==1.1.1-2728-py2.7
pillow==2.3.0
pss==1.38
psycopg2==2.4.5
py2exe==0.6.9
pytz==2012h
pywin32==218
virtualenv==1.11.2

So I edit it down to the following, create a directory and save it as
C:\users\miked\env\proj-x\requirements\requirements.txt

Django==1.5.4
South==0.7.6
coverage==3.7
django-discover-runner==1.0
pillow==2.3.0
psycopg2==2.4.5
pytz==2013.9

pip install -r C:\users\miked\env\proj-x\requirements\requirements.txt

And this where (my) problems start. First pip will download the packages
successfully but I don't have Visual Studio installed so those packages
requiring compilation don't get installed. Here is a snippet of pip
output
after the downloads:

Installing collected packages: Django, South, coverage,
django-discover-runner, pillow, psycopg2, pytz
Running setup.py install for Django

... and so on until errors start to appear. In my case the signal is:

error: Unable to find vcvarsall.bat

Afterwards, pip freeze shows:

(proj-x) C:\users\miked\env\proj-x>pip freeze
Django==1.5.4
South==0.7.6
coverage==3.7
django-discover-runner==1.0

... which indicates pillow, psycopg2 and pytz did not install.

But how come they were installed in the main site-packages? That's
because
they were originally downloaded from
h

Re: virtualenv on Windows

2014-02-03 Thread CLIFFORD ILKAY
On 02/03/2014 05:11 AM, Mike Dewhirst wrote:
>
> However, this evening at the Melbourne PUG meeting I heard about
> Anaconda which apparently make virtualenv passé. Haven't looked at it
> yet. Might be a day or so ...

That's an unfortunate choice of a name for a Python related project
given that the Fedora/Red Hat installer is called Anaconda and is
written in Python.

-- 
Regards,

Clifford Ilkay

647-778-8696

Dinamis



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52EF71BD.3060005%40dinamis.com.
For more options, visit https://groups.google.com/groups/opt_out.


Experience with django-redshift & django-pyodbc-azure ORMs?

2014-02-03 Thread damondeville
Would anyone be kind enough to share with us their experience in using the 
following django drivers for cloud databases:

- django redshift: https://github.com/binarydud/django-redshift, which 
adapts the postgresql driver to the specificities of Amazon Redshift

- django sql 
azure: 
https://github.com/michiya/django-pyodbc-azure/tree/azure-1.1/sql_server/pyodbc 
which adapts the mssqls driver to the specificities of SQL Azure

Thanks a lot!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ef71e01-40bc-45ea-a587-0001d8fd541b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to count the amount of objects in a django joined table?

2014-02-03 Thread hykyd
My problem is simple: I have **Users** who own **Assets** or **Assets** 
which belong to Users If you prefer and I cannot make it to retrieve the 
number (count) of **Assets** each **User** has. I know this might be sound 
silly to most of you but I am new to python/django (coming from PHP/MySQL) 
and I do not know how things work here. I do not want to be engaged with 
raw SQL - this would be my last choice If nothing else works. 

(*) I have removed all non-related raws from the code

**Users**

class Users(models.Model):
firstname = models.CharField(max_length=100)
lastname = models.CharField(max_length=100)

**Assets**

class Assets(models.Model):
serial = models.CharField(unique=True, max_length=100)
user = models.ForeignKey('Users', blank=True, null=True)

# this is what I am playing with to retrieve the number of assets 
each user owns
@classmethod
def user_assets(self):
return Assets.objects.filter(user=user).count()

**views.py** 

class UserList(ListView):
model = Users
def get_context_data(self, **kwargs):
context = super(UserList, self).get_context_data(**kwargs)
context['user_assets'] = self.model.user_assets()
return context

**template** 

{% for user in object_list %}
 
 {{ user.id }}
 
 {{ user_assets }}
 
 
{% endfor %}

How can I get that number? I have read about aggregations, annotations and 
filters but can't really get it.

I am looking for a simple solution by using class based views and easily 
expandable (I may want to add other models later)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e43421ba-5d8f-4f89-85ca-edeb6ff6e1f3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to count the amount of objects in a django joined table?

2014-02-03 Thread Lucas Magnum
{% for user in object_list %}
 
 {{ user.id }}
 
 Number of assets: {{ user.assets_set.count }}
 

{% endfor %}


[]'s

Lucas Magnum.


2014-02-03 hykyd :

> My problem is simple: I have **Users** who own **Assets** or **Assets**
> which belong to Users If you prefer and I cannot make it to retrieve the
> number (count) of **Assets** each **User** has. I know this might be sound
> silly to most of you but I am new to python/django (coming from PHP/MySQL)
> and I do not know how things work here. I do not want to be engaged with
> raw SQL - this would be my last choice If nothing else works.
>
> (*) I have removed all non-related raws from the code
>
> **Users**
>
> class Users(models.Model):
> firstname = models.CharField(max_length=100)
> lastname = models.CharField(max_length=100)
>
> **Assets**
>
> class Assets(models.Model):
> serial = models.CharField(unique=True, max_length=100)
> user = models.ForeignKey('Users', blank=True, null=True)
>
> # this is what I am playing with to retrieve the number of assets
> each user owns
> @classmethod
> def user_assets(self):
> return Assets.objects.filter(user=user).count()
>
> **views.py**
>
> class UserList(ListView):
> model = Users
> def get_context_data(self, **kwargs):
> context = super(UserList, self).get_context_data(**kwargs)
> context['user_assets'] = self.model.user_assets()
> return context
>
> **template**
>
> {% for user in object_list %}
>  
>  {{ user.id }}
>  
>  {{ user_assets }}
>  
>  
> {% endfor %}
>
> How can I get that number? I have read about aggregations, annotations and
> filters but can't really get it.
>
> I am looking for a simple solution by using class based views and easily
> expandable (I may want to add other models later)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e43421ba-5d8f-4f89-85ca-edeb6ff6e1f3%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAB7jOwJNjPC6LkPcK26eMZN463%2BZHXi65Xg%2B1ziwQjVfX9x8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Do I need an API?

2014-02-03 Thread BikerJim
Hi,

I have a fairly simple Django site up and running on Heroku kind of a test 
project for me, all is well and I'm pretty happy with my progress so far: 
easylaughs.herokuapp.com

Its a site for managing weekly theatre shows, workshops and courses and it 
was intended to run alongside, possibly eventually to replace, the flat 
HTML pages at www.easylaughs.nl, which is updated manually by three 
volunteers with an FTP account (bit old fashioned but there you go) :)

However there have been some grumblings about a few things, mainly that 
they are used to login with FTP, edit the HTML and upload the edited 
HTML/CSS, and they don't want to get into git, virtualenvs, python etc, but 
they still want to be able to edit the 'HTML pages' occasionally. I have 
given them a few flatpages to play with (the /press/ url for example), and 
explained that if there is data that changes it either should go in a 
flatpage or in the database...but that doesn't seem to cut it for (one of) 
them. (and I don't really want to end up being the only fella responsible 
for the website, so it would be nice to hand off some responsibility e.g. 
for the styling). There is also a worry about the hard won SEO... but 
that's for another thread...

I had a thought that they might be able to pull the django generated data 
from the flat HTML site and embed it, using javascript or something? For 
example, a stripped out version of the 'Next Show' and 'Next Workshop' data 
on the front page?

Do I need an API for this, or can they just pull the Django generated HTML 
in directly with Javascript somehow? I don't really want to suggest an 
iframe.. I understand they're even more old fashioned than FTP ;)

I've been reading up on django-rest-framework and it looks like just what I 
need, but I don't want to do work I don't need to (although it *would *be 
another interesting thing to learn!). They can CRUD the data from the 
admin, so it'll only be GET requests, so is an API just overkill?

Pointers for further reading very welcome, and I fully accept this might be 
a very, very stupid question. I really appreciate any advice you might have!

Thanks
Jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04dce4d6-4fa8-4025-9668-200bf7788efc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Weird deletions in Django

2014-02-03 Thread heidi
 

I have a web game in which an alliance can have multiple members. This is 
represented by a foreign key field on each member's class (seeing as a 
member can only be part of one alliance).

I've been getting weird instances of worlds and alliances being deleted. I 
narrowed it down to where I was sure the worlds were getting deleted only 
because the alliances were, so I removed the cascade deletion. However, I 
still cannot figure out for the life of me *why* the alliances are being 
deleted in the first place.

I overrode the custom delete method like so:
class Alliance(models.Model): 
... 
def delete(self, *args, **kwargs): 
mail.send_mail('Alliance Deletion', '%s has been deleted.' \ 
% self.alliance_name, 'f...@email.com', ['t...@email.com']) 
super(Alliance, self).delete(*args, **kwargs)


However, at least one alliance has been deleted where I did not get an 
email sent to me. I gather this is because I must be calling delete() from 
a QuerySet, but I have been over my code with a fine-toothed comb and there 
is precisely one occasion where I call delete() on any alliance instance, 
and it's not over a QuerySet.

Is there a way to track down what is causing this, or to find out what 
function has executed the delete of an object?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e1ee2b07-6685-41e0-a7c4-9b45cd1eba84%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread werefrog

Hello,

For Windows, I tried many ways that worked but I finally installed 
Visual Studio 2008 C++ for the compilation problems and only pillow and 
psycopg2 resist in my case (I simply extract the content of the binaries 
from http://www.lfd.uci.edu/~gohlke/pythonlibs/, copy content from 
'SCRIPTS' to project's virtualenv 'Scripts' and 'PLATLIB' to project's 
virtualven 'Lib/site-packages'; I'll give a try to the easy_install with 
them, thank you).


While speaking of psycopg2, I spent a ridiculous amount of time 
struggling with postgresql installation on Windows to finally discover 
that you should stick to ASCII for the password chosen on this platform. 
(Yes, I missed some warning).


You can use virtualenvwrapper-win on Windows. The documentation is short 
and efficient but here is some basic steps, begining from install:


pip install -U virtualenv
pip install -U virtualenvwrapper-win

You have to set WORKON_HOME environment variable to to directory where 
will be grouped your virtualenvs to make it convenient.


Update pip and setuptools:

easy_install -U pip
pip install -U setuptools

Then, create your virtualenv:

mkvirtualenv myproject

Activate the virtualenv (you will then be on %WORKON_HOME%/myproject/):

workon myproject

I keep projects in their own directory independant from virtualenv. To 
add your project directory to its virualenv's pythonpath, use the 
following command where  can be full or relative:


setprojectdir 

Now, install your requirements:

pip install -r requirements.txt

You can use cdproject and cdvirtualenv commands to go to project and 
virtualenv directories.


To go back to the 'general' environment, just type:

deactivate

Additional details you probably already know: remember to not rely on 
the registry to execute your python scripts :) for example:


python manage.py runserver

and not:

manage.py runserver

Edit you virtualenv's Script\activate.bat to add any other specific 
environment variables and don't forget .pth files for specific python path.


That's all for today!

Regards,
Michel

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52EFFE0E.9080801%40yahoo.fr.
For more options, visit https://groups.google.com/groups/opt_out.


Collapsible inlines in Django Admin

2014-02-03 Thread heidi
 

Is there an up-to-date option for allowing collapsible inlines in the 
Django admin site?

I've looked at https://code.djangoproject.com/ticket/494, How to add 
'collapse' to a Django 
StackedInlineand
 Grappelli, but none of them seem to work for Django 1.6.1.

Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bcde9735-df37-42d0-a3d4-9fd5f66e2059%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread Mike Dewhirst

Michel

I learned quite a lot and appreciate it greatly!

Thankyou

Mike

On 4/02/2014 7:37am, werefrog wrote:

Hello,

For Windows, I tried many ways that worked but I finally installed
Visual Studio 2008 C++ for the compilation problems and only pillow and
psycopg2 resist in my case (I simply extract the content of the binaries
from http://www.lfd.uci.edu/~gohlke/pythonlibs/, copy content from
'SCRIPTS' to project's virtualenv 'Scripts' and 'PLATLIB' to project's
virtualven 'Lib/site-packages'; I'll give a try to the easy_install with
them, thank you).

While speaking of psycopg2, I spent a ridiculous amount of time
struggling with postgresql installation on Windows to finally discover
that you should stick to ASCII for the password chosen on this platform.
(Yes, I missed some warning).

You can use virtualenvwrapper-win on Windows. The documentation is short
and efficient but here is some basic steps, begining from install:

 pip install -U virtualenv
 pip install -U virtualenvwrapper-win

You have to set WORKON_HOME environment variable to to directory where
will be grouped your virtualenvs to make it convenient.

Update pip and setuptools:

 easy_install -U pip
 pip install -U setuptools

Then, create your virtualenv:

 mkvirtualenv myproject

Activate the virtualenv (you will then be on %WORKON_HOME%/myproject/):

 workon myproject

I keep projects in their own directory independant from virtualenv. To
add your project directory to its virualenv's pythonpath, use the
following command where  can be full or relative:

 setprojectdir 

Now, install your requirements:

 pip install -r requirements.txt

You can use cdproject and cdvirtualenv commands to go to project and
virtualenv directories.

To go back to the 'general' environment, just type:

 deactivate

Additional details you probably already know: remember to not rely on
the registry to execute your python scripts :) for example:

 python manage.py runserver

and not:

 manage.py runserver

Edit you virtualenv's Script\activate.bat to add any other specific
environment variables and don't forget .pth files for specific python path.

That's all for today!

Regards,
Michel



--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F021F0.1050004%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread Nick Santos
FYI, virtualenvwrapper was ported to windows:
https://pypi.python.org/pypi/virtualenvwrapper-win

It works seamlessly like the linux/OSX versions
-Nick 



On Mon, Feb 3, 2014 at 3:10 PM, Mike Dewhirst  wrote:

> Michel
>
> I learned quite a lot and appreciate it greatly!
>
> Thankyou
>
> Mike
>
>
> On 4/02/2014 7:37am, werefrog wrote:
>
>> Hello,
>>
>> For Windows, I tried many ways that worked but I finally installed
>> Visual Studio 2008 C++ for the compilation problems and only pillow and
>> psycopg2 resist in my case (I simply extract the content of the binaries
>> from http://www.lfd.uci.edu/~gohlke/pythonlibs/, copy content from
>> 'SCRIPTS' to project's virtualenv 'Scripts' and 'PLATLIB' to project's
>> virtualven 'Lib/site-packages'; I'll give a try to the easy_install with
>> them, thank you).
>>
>> While speaking of psycopg2, I spent a ridiculous amount of time
>> struggling with postgresql installation on Windows to finally discover
>> that you should stick to ASCII for the password chosen on this platform.
>> (Yes, I missed some warning).
>>
>> You can use virtualenvwrapper-win on Windows. The documentation is short
>> and efficient but here is some basic steps, begining from install:
>>
>>  pip install -U virtualenv
>>  pip install -U virtualenvwrapper-win
>>
>> You have to set WORKON_HOME environment variable to to directory where
>> will be grouped your virtualenvs to make it convenient.
>>
>> Update pip and setuptools:
>>
>>  easy_install -U pip
>>  pip install -U setuptools
>>
>> Then, create your virtualenv:
>>
>>  mkvirtualenv myproject
>>
>> Activate the virtualenv (you will then be on %WORKON_HOME%/myproject/):
>>
>>  workon myproject
>>
>> I keep projects in their own directory independant from virtualenv. To
>> add your project directory to its virualenv's pythonpath, use the
>> following command where  can be full or relative:
>>
>>  setprojectdir 
>>
>> Now, install your requirements:
>>
>>  pip install -r requirements.txt
>>
>> You can use cdproject and cdvirtualenv commands to go to project and
>> virtualenv directories.
>>
>> To go back to the 'general' environment, just type:
>>
>>  deactivate
>>
>> Additional details you probably already know: remember to not rely on
>> the registry to execute your python scripts :) for example:
>>
>>  python manage.py runserver
>>
>> and not:
>>
>>  manage.py runserver
>>
>> Edit you virtualenv's Script\activate.bat to add any other specific
>> environment variables and don't forget .pth files for specific python
>> path.
>>
>> That's all for today!
>>
>> Regards,
>> Michel
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/52F021F0.1050004%40dewhirst.com.au.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAM1S3vC2v9Hb-PgMZXwH0N_yTzZdy1TgcJ7X20VGNu-8mMatvA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread Mike Dewhirst

Thanks Nick

All this goodness is coming to light just I have (almost) given up 
Windows altogether. I only need to persuade one more person on my 
network to walk away from Microsoft and I'm free! FREE!


Sob ...

Mike

On 4/02/2014 10:39am, Nick Santos wrote:

FYI, virtualenvwrapper was ported to windows:
https://pypi.python.org/pypi/virtualenvwrapper-win

It works seamlessly like the linux/OSX versions
-Nick



On Mon, Feb 3, 2014 at 3:10 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote:

Michel

I learned quite a lot and appreciate it greatly!

Thankyou

Mike


On 4/02/2014 7:37am, werefrog wrote:

Hello,

For Windows, I tried many ways that worked but I finally installed
Visual Studio 2008 C++ for the compilation problems and only pillow
and psycopg2 resist in my case (I simply extract the content of the
binaries from http://www.lfd.uci.edu/~__gohlke/pythonlibs/
, copy content from
'SCRIPTS' to project's virtualenv 'Scripts' and 'PLATLIB' to
project's virtualven 'Lib/site-packages'; I'll give a try to the
easy_install with them, thank you).

While speaking of psycopg2, I spent a ridiculous amount of time
struggling with postgresql installation on Windows to finally
discover that you should stick to ASCII for the password chosen on
this platform. (Yes, I missed some warning).

You can use virtualenvwrapper-win on Windows. The documentation is
short and efficient but here is some basic steps, begining from
install:

pip install -U virtualenv pip install -U virtualenvwrapper-win

You have to set WORKON_HOME environment variable to to directory
where will be grouped your virtualenvs to make it convenient.

Update pip and setuptools:

easy_install -U pip pip install -U setuptools

Then, create your virtualenv:

mkvirtualenv myproject

Activate the virtualenv (you will then be on
%WORKON_HOME%/myproject/):

workon myproject

I keep projects in their own directory independant from virtualenv.
To add your project directory to its virualenv's pythonpath, use the
following command where  can be full or relative:

setprojectdir 

Now, install your requirements:

pip install -r requirements.txt

You can use cdproject and cdvirtualenv commands to go to project and
virtualenv directories.

To go back to the 'general' environment, just type:

deactivate

Additional details you probably already know: remember to not rely
on the registry to execute your python scripts :) for example:

python manage.py runserver

and not:

manage.py runserver

Edit you virtualenv's Script\activate.bat to add any other specific
environment variables and don't forget .pth files for specific python
path.

That's all for today!

Regards, Michel


-- You received this message because you are subscribed to the
Google Groups "Django users" group. To unsubscribe from this group
and stop receiving emails from it, send an email to
django-users+unsubscribe@__googlegroups.com
. To post to this
group, send email to django-users@googlegroups.com
. Visit this group at
http://groups.google.com/__group/django-users
. To view this
discussion on the web visit
https://groups.google.com/d/__msgid/django-users/52F021F0.__1050004%40dewhirst.com.au



.


For more options, visit https://groups.google.com/__groups/opt_out
.


-- You received this message because you are subscribed to the Google
 Groups "Django users" group. To unsubscribe from this group and stop
receiving emails from it, send an email to
django-users+unsubscr...@googlegroups.com. To post to this group,
send email to django-users@googlegroups.com. Visit this group at
http://groups.google.com/group/django-users. To view this discussion
on the web visit
https://groups.google.com/d/msgid/django-users/CAM1S3vC2v9Hb-PgMZXwH0N_yTzZdy1TgcJ7X20VGNu-8mMatvA%40mail.gmail.com.



For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52F0348D.90102%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do I need an API?

2014-02-03 Thread m1chael
I deal with the same thing... and i've set up the template directories
for them to access, and it works OK.. but I still hear complaints from
the old timers that won't want to conform to this new way of doing
things,

This isn't a stupid question at all. I'm hoping someone can give a
truly thoughtful response to this.


Mike

On Mon, Feb 3, 2014 at 2:17 PM, BikerJim  wrote:
> Hi,
>
> I have a fairly simple Django site up and running on Heroku kind of a test
> project for me, all is well and I'm pretty happy with my progress so far:
> easylaughs.herokuapp.com
>
> Its a site for managing weekly theatre shows, workshops and courses and it
> was intended to run alongside, possibly eventually to replace, the flat HTML
> pages at www.easylaughs.nl, which is updated manually by three volunteers
> with an FTP account (bit old fashioned but there you go) :)
>
> However there have been some grumblings about a few things, mainly that they
> are used to login with FTP, edit the HTML and upload the edited HTML/CSS,
> and they don't want to get into git, virtualenvs, python etc, but they still
> want to be able to edit the 'HTML pages' occasionally. I have given them a
> few flatpages to play with (the /press/ url for example), and explained that
> if there is data that changes it either should go in a flatpage or in the
> database...but that doesn't seem to cut it for (one of) them. (and I don't
> really want to end up being the only fella responsible for the website, so
> it would be nice to hand off some responsibility e.g. for the styling).
> There is also a worry about the hard won SEO... but that's for another
> thread...
>
> I had a thought that they might be able to pull the django generated data
> from the flat HTML site and embed it, using javascript or something? For
> example, a stripped out version of the 'Next Show' and 'Next Workshop' data
> on the front page?
>
> Do I need an API for this, or can they just pull the Django generated HTML
> in directly with Javascript somehow? I don't really want to suggest an
> iframe.. I understand they're even more old fashioned than FTP ;)
>
> I've been reading up on django-rest-framework and it looks like just what I
> need, but I don't want to do work I don't need to (although it would be
> another interesting thing to learn!). They can CRUD the data from the admin,
> so it'll only be GET requests, so is an API just overkill?
>
> Pointers for further reading very welcome, and I fully accept this might be
> a very, very stupid question. I really appreciate any advice you might have!
>
> Thanks
> Jim
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/04dce4d6-4fa8-4025-9668-200bf7788efc%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAuoY6OrEF6kqnsx7xGFKEdncccuj4_r%3DtADNka8A8Vg2it51Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Do I need an API?

2014-02-03 Thread Drew Ferguson
Hi guys

Have you considered using a Content Management System? This is what they
are designed for - to make it easy to add and manage content. Check out
the various Django CMSs and their plugins/extra modules. Or there are some
excellent non-Django OSS CMSs out their too.

There are good reasons to limit unrestrained access to CSS and HTML though
most good CMSs will allow you to relax such rules for your users if you
really need to.

On Mon, 3 Feb 2014 21:31:18 -0500
m1chael  wrote:

> I deal with the same thing... and i've set up the template directories
> for them to access, and it works OK.. but I still hear complaints from
> the old timers that won't want to conform to this new way of doing
> things,
> 
> This isn't a stupid question at all. I'm hoping someone can give a
> truly thoughtful response to this.
> 
> 
> Mike
> 
> On Mon, Feb 3, 2014 at 2:17 PM, BikerJim  wrote:
> > Hi,
> >
> > I have a fairly simple Django site up and running on Heroku kind of a
> > test project for me, all is well and I'm pretty happy with my progress
> > so far: easylaughs.herokuapp.com
> >
> > Its a site for managing weekly theatre shows, workshops and courses
> > and it was intended to run alongside, possibly eventually to replace,
> > the flat HTML pages at www.easylaughs.nl, which is updated manually by
> > three volunteers with an FTP account (bit old fashioned but there you
> > go) :)
> >
> > However there have been some grumblings about a few things, mainly
> > that they are used to login with FTP, edit the HTML and upload the
> > edited HTML/CSS, and they don't want to get into git, virtualenvs,
> > python etc, but they still want to be able to edit the 'HTML pages'
> > occasionally. I have given them a few flatpages to play with
> > (the /press/ url for example), and explained that if there is data
> > that changes it either should go in a flatpage or in the
> > database...but that doesn't seem to cut it for (one of) them. (and I
> > don't really want to end up being the only fella responsible for the
> > website, so it would be nice to hand off some responsibility e.g. for
> > the styling). There is also a worry about the hard won SEO... but
> > that's for another thread...
> >
> > I had a thought that they might be able to pull the django generated
> > data from the flat HTML site and embed it, using javascript or
> > something? For example, a stripped out version of the 'Next Show' and
> > 'Next Workshop' data on the front page?
> >
> > Do I need an API for this, or can they just pull the Django generated
> > HTML in directly with Javascript somehow? I don't really want to
> > suggest an iframe.. I understand they're even more old fashioned than
> > FTP ;)
> >
> > I've been reading up on django-rest-framework and it looks like just
> > what I need, but I don't want to do work I don't need to (although it
> > would be another interesting thing to learn!). They can CRUD the data
> > from the admin, so it'll only be GET requests, so is an API just
> > overkill?
> >
> > Pointers for further reading very welcome, and I fully accept this
> > might be a very, very stupid question. I really appreciate any advice
> > you might have!
> >
> > Thanks
> > Jim
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/django-users/04dce4d6-4fa8-4025-9668-200bf7788efc%40googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> 



-- 
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140204031903.1f3f8d9b%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread Avraham Serour
You can easily install pillow on windows using 'easy_install pillow' it
comes with the necessary binaries and you don't need to compile
On Feb 4, 2014 2:30 AM, "Mike Dewhirst"  wrote:

> Thanks Nick
>
> All this goodness is coming to light just I have (almost) given up Windows
> altogether. I only need to persuade one more person on my network to walk
> away from Microsoft and I'm free! FREE!
>
> Sob ...
>
> Mike
>
> On 4/02/2014 10:39am, Nick Santos wrote:
>
>> FYI, virtualenvwrapper was ported to windows:
>> https://pypi.python.org/pypi/virtualenvwrapper-win
>>
>> It works seamlessly like the linux/OSX versions
>> -Nick
>>
>>
>>
>> On Mon, Feb 3, 2014 at 3:10 PM, Mike Dewhirst >  > wrote:
>>
>> Michel
>>
>> I learned quite a lot and appreciate it greatly!
>>
>> Thankyou
>>
>> Mike
>>
>>
>> On 4/02/2014 7:37am, werefrog wrote:
>>
>> Hello,
>>
>> For Windows, I tried many ways that worked but I finally installed
>> Visual Studio 2008 C++ for the compilation problems and only pillow
>> and psycopg2 resist in my case (I simply extract the content of the
>> binaries from http://www.lfd.uci.edu/~__gohlke/pythonlibs/
>> , copy content from
>> 'SCRIPTS' to project's virtualenv 'Scripts' and 'PLATLIB' to
>> project's virtualven 'Lib/site-packages'; I'll give a try to the
>> easy_install with them, thank you).
>>
>> While speaking of psycopg2, I spent a ridiculous amount of time
>> struggling with postgresql installation on Windows to finally
>> discover that you should stick to ASCII for the password chosen on
>> this platform. (Yes, I missed some warning).
>>
>> You can use virtualenvwrapper-win on Windows. The documentation is
>> short and efficient but here is some basic steps, begining from
>> install:
>>
>> pip install -U virtualenv pip install -U virtualenvwrapper-win
>>
>> You have to set WORKON_HOME environment variable to to directory
>> where will be grouped your virtualenvs to make it convenient.
>>
>> Update pip and setuptools:
>>
>> easy_install -U pip pip install -U setuptools
>>
>> Then, create your virtualenv:
>>
>> mkvirtualenv myproject
>>
>> Activate the virtualenv (you will then be on
>> %WORKON_HOME%/myproject/):
>>
>> workon myproject
>>
>> I keep projects in their own directory independant from virtualenv.
>> To add your project directory to its virualenv's pythonpath, use the
>> following command where  can be full or relative:
>>
>> setprojectdir 
>>
>> Now, install your requirements:
>>
>> pip install -r requirements.txt
>>
>> You can use cdproject and cdvirtualenv commands to go to project and
>> virtualenv directories.
>>
>> To go back to the 'general' environment, just type:
>>
>> deactivate
>>
>> Additional details you probably already know: remember to not rely
>> on the registry to execute your python scripts :) for example:
>>
>> python manage.py runserver
>>
>> and not:
>>
>> manage.py runserver
>>
>> Edit you virtualenv's Script\activate.bat to add any other specific
>> environment variables and don't forget .pth files for specific python
>> path.
>>
>> That's all for today!
>>
>> Regards, Michel
>>
>>
>> -- You received this message because you are subscribed to the
>> Google Groups "Django users" group. To unsubscribe from this group
>> and stop receiving emails from it, send an email to
>> django-users+unsubscribe@__googlegroups.com
>> . To post to this
>> group, send email to django-users@googlegroups.com
>> . Visit this group at
>> http://groups.google.com/__group/django-users
>> . To view this
>> discussion on the web visit
>> https://groups.google.com/d/__msgid/django-users/52F021F0.__
>> 1050004%40dewhirst.com.au
>>
>>
>>   1050004%40dewhirst.com.au>.
>
>>
>> For more options, visit https://groups.google.com/__groups/opt_out
>> .
>>
>>
>> -- You received this message because you are subscribed to the Google
>>  Groups "Django users" group. To unsubscribe from this group and stop
>> receiving emails from it, send an email to
>> django-users+unsubscr...@googlegroups.com. To post to this group,
>> send email to django-users@googlegroups.com. Visit this group at
>> http://groups.google.com/group/django-users. To view this discussion
>> on the web visit
>> https://groups.google.com/d/msgid/django-users/CAM1S3vC2v9Hb-PgMZXwH0N_
>> yTzZdy1TgcJ7X20VGNu-8mMatvA%40mail.gmail.com.
>>
>>
>>  For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googleg

Re: Weird deletions in Django

2014-02-03 Thread Avraham Serour
Sending an email can be faulty, I would use a logger and write the
stacktrace
Also, is it possible that something other than you django application it's
agreeing the database?
On Feb 3, 2014 10:32 PM, "heidi"  wrote:

> I have a web game in which an alliance can have multiple members. This is
> represented by a foreign key field on each member's class (seeing as a
> member can only be part of one alliance).
>
> I've been getting weird instances of worlds and alliances being deleted. I
> narrowed it down to where I was sure the worlds were getting deleted only
> because the alliances were, so I removed the cascade deletion. However, I
> still cannot figure out for the life of me *why* the alliances are being
> deleted in the first place.
>
> I overrode the custom delete method like so:
> class Alliance(models.Model):
> ...
> def delete(self, *args, **kwargs):
> mail.send_mail('Alliance Deletion', '%s has been deleted.' \
> % self.alliance_name, 'f...@email.com', ['t...@email.com'])
> super(Alliance, self).delete(*args, **kwargs)
>
>
> However, at least one alliance has been deleted where I did not get an
> email sent to me. I gather this is because I must be calling delete() from
> a QuerySet, but I have been over my code with a fine-toothed comb and there
> is precisely one occasion where I call delete() on any alliance instance,
> and it's not over a QuerySet.
>
> Is there a way to track down what is causing this, or to find out what
> function has executed the delete of an object?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e1ee2b07-6685-41e0-a7c4-9b45cd1eba84%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tJBoDS5pvLONorYaUTdPS_7fwPTksaXR9hPo5%2BDUPL_iw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: virtualenv on Windows

2014-02-03 Thread Mike Dewhirst

On 4/02/2014 5:31pm, Avraham Serour wrote:

You can easily install pillow on windows using 'easy_install pillow' it
comes with the necessary binaries and you don't need to compile


Bingo! Yes - it puts it in an egg.

Thanks Avraham




On Feb 4, 2014 2:30 AM, "Mike Dewhirst" mailto:mi...@dewhirst.com.au>> wrote:

Thanks Nick

All this goodness is coming to light just I have (almost) given up
Windows altogether. I only need to persuade one more person on my
network to walk away from Microsoft and I'm free! FREE!

Sob ...

Mike

On 4/02/2014 10:39am, Nick Santos wrote:

FYI, virtualenvwrapper was ported to windows:
https://pypi.python.org/pypi/__virtualenvwrapper-win


It works seamlessly like the linux/OSX versions
-Nick>



On Mon, Feb 3, 2014 at 3:10 PM, Mike Dewhirst
mailto:mi...@dewhirst.com.au>
  >__> wrote:

Michel

I learned quite a lot and appreciate it greatly!

Thankyou

Mike


On 4/02/2014 7:37am, werefrog wrote:

Hello,

For Windows, I tried many ways that worked but I finally installed
Visual Studio 2008 C++ for the compilation problems and only pillow
and psycopg2 resist in my case (I simply extract the content of the
binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/

>, copy content from
'SCRIPTS' to project's virtualenv 'Scripts' and 'PLATLIB' to
project's virtualven 'Lib/site-packages'; I'll give a try to the
easy_install with them, thank you).

While speaking of psycopg2, I spent a ridiculous amount of time
struggling with postgresql installation on Windows to finally
discover that you should stick to ASCII for the password chosen on
this platform. (Yes, I missed some warning).

You can use virtualenvwrapper-win on Windows. The documentation is
short and efficient but here is some basic steps, begining from
install:

pip install -U virtualenv pip install -U virtualenvwrapper-win

You have to set WORKON_HOME environment variable to to directory
where will be grouped your virtualenvs to make it convenient.

Update pip and setuptools:

easy_install -U pip pip install -U setuptools

Then, create your virtualenv:

mkvirtualenv myproject

Activate the virtualenv (you will then be on
%WORKON_HOME%/myproject/):

workon myproject

I keep projects in their own directory independant from virtualenv.
To add your project directory to its virualenv's pythonpath, use the
following command where  can be full or relative:

setprojectdir 

Now, install your requirements:

pip install -r requirements.txt

You can use cdproject and cdvirtualenv commands to go to project and
virtualenv directories.

To go back to the 'general' environment, just type:

deactivate

Additional details you probably already know: remember to not rely
on the registry to execute your python scripts :) for example:

python manage.py runserver

and not:

manage.py runserver

Edit you virtualenv's Script\activate.bat to add any other specific
environment variables and don't forget .pth files for specific
python
path.

That's all for today!

Regards, Michel


-- You received this message because you are subscribed to the
Google Groups "Django users" group. To unsubscribe from this group
and stop receiving emails from it, send an email to
django-users+unsubscribe@__goo__glegroups.com

__>. To
post to this
group, send email to django-users@googlegroups.com

>. Visit this group at
http://groups.google.com/group/django-users

>. To view this
discussion on the web visit

https://groups.google.com/d/msgid/django-users/52F021F0.1050004%40dewhirst.com.au