Re: can't adapt type 'Decimal'

2010-08-24 Thread Gabriel Farrell
(I tried to post the below in a comment at poupou's site (http://
www.defitek.com/blog/2010/06/29/cant-adapt-type-decimal-error-with-django-apache-postgresql-psycopg2/),
but kept getting errors.)

Just ran into the same problem. In my mod_wsgi config I had:

WSGIDaemonProcess site1 maximum-requests=1
WSGIProcessGroup site1
WSGIScriptAlias /site1 /var/www/site1/django.wsgi

WSGIDaemonProcess site2 maximum-requests=1
WSGIProcessGroup site2
WSGIScriptAlias /site2 /var/www/site2/django.wsgi

I was getting errors with that, but with the "process-group" parameter
things are running fine. Funny that at 
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives
the only place where "process-group" is mentioned is in the
WSGIImportScript section.


On Jun 28, 5:01 pm, poupou  wrote:
> I confirm that everything is working fine now.
>
> Thank you again.
>
> On 25 juin, 13:12, poupou  wrote:
>
>
>
>
>
>
>
> > Yes I'm running two sites on the same server.  Only difference with
> > you is that I'm running it with virtual host.
>
> > I modifier my Apache config, now it looks like this :
>
> > 
> >   ServerName  site1.com
> >   WSGIDaemonProcess site1
> >   WSGIScriptAlias / /var/www/site1.wsgi process-group=site1
> > application-group=%{GLOBAL}
>
> > 
>
> > 
> >   ServerName  site2.com
> >   WSGIDaemonProcess site2
> >   WSGIScriptAlias / /var/www/site2.wsgi process-group=site2
> > application-group=%{GLOBAL}
>
> > 
>
> > It will take a little to make sure it's working, I will report on this
> > thread if everything is ok.
>
> > Thank you!
>
> > On 25 juin, 10:51, Stuart  wrote:
>
> > > On Jun 25, 8:06 am, poupou  wrote:
>
> > > >   Of the 2 web site that I have, It only happens where I make request
> > > > using the the Q objects.
>
> > > If you have two django sites/projects on the same server 
> > > (e.g.http://myserver/app1andhttp://myserver/app2) and you are using
> > > mod_wsgi, I bet you're having the same problem I was. To fix it,
> > > upgrade to the latest version of mod_wsgi and run it in daemon mode.
> > > See here for 
> > > details:http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323
>
> > > Hope that helps,
>
> > > --Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: can't adapt type 'Decimal'

2010-06-28 Thread poupou
I confirm that everything is working fine now.

Thank you again.

On 25 juin, 13:12, poupou  wrote:
> Yes I'm running two sites on the same server.  Only difference with
> you is that I'm running it with virtual host.
>
> I modifier my Apache config, now it looks like this :
>
> 
>   ServerName  site1.com
>   WSGIDaemonProcess site1
>   WSGIScriptAlias / /var/www/site1.wsgi process-group=site1
> application-group=%{GLOBAL}
>
> 
>
> 
>   ServerName  site2.com
>   WSGIDaemonProcess site2
>   WSGIScriptAlias / /var/www/site2.wsgi process-group=site2
> application-group=%{GLOBAL}
>
> 
>
> It will take a little to make sure it's working, I will report on this
> thread if everything is ok.
>
> Thank you!
>
> On 25 juin, 10:51, Stuart  wrote:
>
>
>
> > On Jun 25, 8:06 am, poupou  wrote:
>
> > >   Of the 2 web site that I have, It only happens where I make request
> > > using the the Q objects.
>
> > If you have two django sites/projects on the same server 
> > (e.g.http://myserver/app1andhttp://myserver/app2) and you are using
> > mod_wsgi, I bet you're having the same problem I was. To fix it,
> > upgrade to the latest version of mod_wsgi and run it in daemon mode.
> > See here for 
> > details:http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323
>
> > Hope that helps,
>
> > --Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: can't adapt type 'Decimal'

2010-06-25 Thread poupou
Yes I'm running two sites on the same server.  Only difference with
you is that I'm running it with virtual host.

I modifier my Apache config, now it looks like this :


  ServerName  site1.com
  WSGIDaemonProcess site1
  WSGIScriptAlias / /var/www/site1.wsgi process-group=site1
application-group=%{GLOBAL}




  ServerName  site2.com
  WSGIDaemonProcess site2
  WSGIScriptAlias / /var/www/site2.wsgi process-group=site2
application-group=%{GLOBAL}



It will take a little to make sure it's working, I will report on this
thread if everything is ok.

Thank you!

On 25 juin, 10:51, Stuart  wrote:
> On Jun 25, 8:06 am, poupou  wrote:
>
>
>
> >   Of the 2 web site that I have, It only happens where I make request
> > using the the Q objects.
>
> If you have two django sites/projects on the same server 
> (e.g.http://myserver/app1andhttp://myserver/app2) and you are using
> mod_wsgi, I bet you're having the same problem I was. To fix it,
> upgrade to the latest version of mod_wsgi and run it in daemon mode.
> See here for 
> details:http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323
>
> Hope that helps,
>
> --Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: can't adapt type 'Decimal'

2010-06-25 Thread Stuart
On Jun 25, 8:06 am, poupou  wrote:
>
>   Of the 2 web site that I have, It only happens where I make request
> using the the Q objects.
>

If you have two django sites/projects on the same server (e.g.
http://myserver/app1 and http://myserver/app2) and you are using
mod_wsgi, I bet you're having the same problem I was. To fix it,
upgrade to the latest version of mod_wsgi and run it in daemon mode.
See here for details: 
http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323


Hope that helps,

--Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: can't adapt type 'Decimal'

2010-06-25 Thread Stuart
On Jun 25, 8:06 am, poupou  wrote:
>
>   Of the 2 web site that I have, It only happens where I make request
> using the the Q objects.
>

Your problem sounds like the problem I just went through. I assume you
are using mod_wsgi. Are the two sites on the same server? For example,
you have one at http://myserver/app1 and the other at http://myserver/app2
-- is that right?

If that's your scenario, upgrade to the latest version of mod_wsgi and
set it to run in daemon mode. For details on how to do that, see here:
http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323


Hope that helps,

--Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



can't adapt type 'Decimal'

2010-06-25 Thread poupou
Hi,

  I'm getting the error "can't adapt type 'Decimal'"  from time to
time in my Django web site.  Once I restart Apache it will works for
few hours, then some users will start to get this error.

  Of the 2 web site that I have, It only happens where I make request
using the the Q objects.

  For example this request :

projets = Projet.objects.filter(Q(termine = u'Non') |
Q(heure_difference__gt = 0 |
Q(termine = u'Oui') &
Q(base_renumeration = u'Forfait'))
for projet in projets:


Wich will end up and with the following traceback :

Traceback:
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
  92. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/auth/
decorators.py" in __call__
  78. return self.view_func(request, *args, **kwargs)
File "/var/www/django/defitek/gestion/views.py" in projet_en_cours
  128. for projet in projets:
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_result_iter
  106. self._fill_cache()
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_fill_cache
  692.
self._result_cache.append(self._iter.next())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
iterator
  238. for row in self.query.results_iter():
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in results_iter
  287. for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in execute_sql
  2369. cursor.execute(sql, params)
File "/usr/lib/python2.4/site-packages/django/db/backends/util.py" in
execute
  19. return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /projet_en_cours/
Exception Value: can't adapt type 'Decimal'

Here are the value that it tryed to use in the request :

return self.cursor.execute(sql, params) ...
▶ Local vars
Variable
Value
params
  (u'Non', Decimal("0"), u'Oui', u'Forfait')
  self
  
  sql
  None
  start
  1277468406.010195
  stop
  1277468406.010242

I'm using : Django 1.1.1, CentOS 5.5, Python-2.4.3-27, mod_wsgi 3.2
and psycopg2-2.2.1

I read many thread that had a can't adapt error, it seems to be
something wrong with psycopg2.  But I have yet to figure out how to
fix this.

Please help.  Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.