Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 9, 2010 00:54:52

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


I'm fairly new to Django, and I'm trying to move an existing Django
application to a new server. The old server is running Django 1.0.2
and Python 2.5.4. The closest I could come on my new server (to start)
is Django 1.0.4 and Python 2.5.5.

Anyway, I get an admin login screen, but when I try to log in, I get
an error:

Exception Type: InvalidOperation
Exception Value: Invalid literal for Decimal: '2010-12-22 17:36:30'
Exception Location: build/bdist.linux-i686/egg/MySQLdb/connections.py
in defaulterrorhandler, line 35

If I'm reading the error page right, it looks like it's happening in
db/models/query.py, somewhere around here:

316. clone = self.filter(*args, **kwargs)
317. num = len(clone) ...

Any advice on how to get past this?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 9, 2010 19:22:33

Dan F.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


Hi there,

> I'm fairly new to Django, and I'm trying to move an existing Django
> application to a new server. The old server is running Django 1.0.2
> and Python 2.5.4. The closest I could come on my new server (to start)
> is Django 1.0.4 and Python 2.5.5.
>
> Anyway, I get an admin login screen, but when I try to log in, I get
> an error:
>
> Exception Type: InvalidOperation
> Exception Value: Invalid literal for Decimal: '2010-12-22 17:36:30'
> Exception Location: build/bdist.linux-i686/egg/MySQLdb/connections.py
> in defaulterrorhandler, line 35
>
> If I'm reading the error page right, it looks like it's happening in
> db/models/query.py, somewhere around here:
>
> 316. clone = self.filter(*args, **kwargs)
> 317. num = len(clone) ...
>
> Any advice on how to get past this?

You'll need to post a longer stack trace, just a fragment isn't much use.
Switch to the copy-and-paste view so you can copy-and-paste it :)

Cheers,
Dan
--
Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com


--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 9, 2010 23:18:53

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


Hi Dan,

Thanks for taking a look... here's the copy-and-paste stack trace.

======

Environment:

Request Method: POST
Request URL:http://sitename.com/admin/Django Version: 1.0.4
Python Version: 2.5.5
Installed Applications:

Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
'pagination.middleware.PaginationMiddleware')


Traceback:
File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
base.py" in get_response
91. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
sites.py" in root
141. if not self.has_permission(request):
File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
sites.py" in has_permission
100. return request.user.is_authenticated() and
request.user.is_staff
File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
middleware.py" in __get__
5. request._cached_user = get_user(request)
File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
__init__.py" in get_user
83. user_id = request.session
File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
backends/base.py" in __getitem__
46. return self._session
File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
backends/base.py" in _get_session
172. self._session_cache = self.load()
File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
backends/db.py" in load
16. expire_date__gt=datetime.datetime.now()
File "/usr/local/lib/python2.5/site-packages/django/db/models/
manager.py" in get
117. return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.5/site-packages/django/db/models/
query.py" in get
317. num = len(clone)
File "/usr/local/lib/python2.5/site-packages/django/db/models/
query.py" in __len__
173. self._result_cache = list(self.iterator())
File "/usr/local/lib/python2.5/site-packages/django/db/models/
query.py" in iterator
288. for row in self.query.results_iter():
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
query.py" in results_iter
205. for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
query.py" in execute_sql
1820. cursor.execute(sql, params)
File "/usr/local/lib/python2.5/site-packages/django/db/backends/
util.py" in execute
19. return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/
base.py" in execute
83. return self.cursor.execute(query, args)
File "build/bdist.linux-i686/egg/MySQLdb/cursors.py" in execute
166. self.errorhandler(self, exc, value)
File "build/bdist.linux-i686/egg/MySQLdb/connections.py" in
defaulterrorhandler
35. raise errorclass, errorvalue

Exception Type: InvalidOperation at /admin/
Exception Value: Invalid literal for Decimal: '2010-12-23 16:53:08'

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 9, 2010 23:47:06

satyandra b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


Hi,

for using MySQl with python MySQLdb and it will work fine :)

enjoy coding.

On Fri, Dec 10, 2010 at 4:48 AM, kinder <ad...@indermaur.com> wrote:

> Hi Dan,
>
> Thanks for taking a look... here's the copy-and-paste stack trace.
>
> ======
>
> Environment:
>
> Request Method: POST
> Request URL:http://sitename.com/admin/> Django Version: 1.0.4
> Python Version: 2.5.5
> Installed Applications:
>
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
> 'pagination.middleware.PaginationMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.5/site-packages/django/core/handlers/
> base.py" in get_response
> 91. response = callback(request, *callback_args,
> **callback_kwargs)
> File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
> sites.py" in root
> 141. if not self.has_permission(request):
> File "/usr/local/lib/python2.5/site-packages/django/contrib/admin/
> sites.py" in has_permission
> 100. return request.user.is_authenticated() and
> request.user.is_staff
> File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
> middleware.py" in __get__
> 5. request._cached_user = get_user(request)
> File "/usr/local/lib/python2.5/site-packages/django/contrib/auth/
> __init__.py" in get_user
> 83. user_id = request.session
> File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
> backends/base.py" in __getitem__
> 46. return self._session
> File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
> backends/base.py" in _get_session
> 172. self._session_cache = self.load()
> File "/usr/local/lib/python2.5/site-packages/django/contrib/sessions/
> backends/db.py" in load
> 16. expire_date__gt=datetime.datetime.now()
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> manager.py" in get
> 117. return self.get_query_set().get(*args, **kwargs)
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> query.py" in get
> 317. num = len(clone)
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> query.py" in __len__
> 173. self._result_cache = list(self.iterator())
> File "/usr/local/lib/python2.5/site-packages/django/db/models/
> query.py" in iterator
> 288. for row in self.query.results_iter():
> File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
> query.py" in results_iter
> 205. for rows in self.execute_sql(MULTI):
> File "/usr/local/lib/python2.5/site-packages/django/db/models/sql/
> query.py" in execute_sql
> 1820. cursor.execute(sql, params)
> File "/usr/local/lib/python2.5/site-packages/django/db/backends/
> util.py" in execute
> 19. return self.cursor.execute(sql, params)
> File "/usr/local/lib/python2.5/site-packages/django/db/backends/mysql/
> base.py" in execute
> 83. return self.cursor.execute(query, args)
> File "build/bdist.linux-i686/egg/MySQLdb/cursors.py" in execute
> 166. self.errorhandler(self, exc, value)
> File "build/bdist.linux-i686/egg/MySQLdb/connections.py" in
> defaulterrorhandler
> 35. raise errorclass, errorvalue
>
> Exception Type: InvalidOperation at /admin/
> Exception Value: Invalid literal for Decimal: '2010-12-23 16:53:08'
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Dec. 10, 2010 00:28:14

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


Ummm... did you mean to say something before the 'for using'? Should I
not use MySQLdb (I'm using version 1.2.2)?

On Dec 9, 5:31 pm, satyandra babu <sbabu....@gmail.com> wrote:
> Hi,
>
> for using MySQl with python MySQLdb and it will work fine :)
>
> enjoy coding.
>
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 Dec. 10, 2010 00:36:49

satyandra b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


MySQLdb is required to use MySQL with python, so but the error is same as
check to import mysqldb if it working fine, i hope the issue is somewhere
mysqldb settings only.


On Fri, Dec 10, 2010 at 5:58 AM, kinder <ad...@indermaur.com> wrote:

> Ummm... did you mean to say something before the 'for using'? Should I
> not use MySQLdb (I'm using version 1.2.2)?
>
> On Dec 9, 5:31 pm, satyandra babu <sbabu....@gmail.com> wrote:
> > Hi,
> >
> > for using MySQl with python MySQLdb and it will work fine :)
> >
> > enjoy coding.
> >
> >
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 Dec. 10, 2010 14:33:18

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


At least superficially, it looks like MySQLDB is working ok - a row
does end up inserted in the django_session table. The reason I am
looking in /usr/local/lib/python2.5/site-packages/django/db/models/
query.py around line 317 is because (according to the interactive
stack trace) that is where the local variable 'clone' takes on the
value "Error in formatting: Invalid literal for Decimal: '2010-12-24
08:25:03'"

I'm hoping this is some kind of database configuration/model-mismatch
problem, or maybe... (the "old" server MySQL version is 5.0.77, the
new, 5.1.47)

Any other ideas?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#8 Dec. 10, 2010 15:38:32

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


After some more futzing around this morning, I'm thinking this might
be a shared library version mismatch, maybe with the MySQL client
shared libraries? How can I find out what version django/python is
using?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#9 Dec. 11, 2010 03:31:26

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


I'm stumped... even removing mod_php from the apache config (which is
where I suspected a different mysql shared library), I still get the
same InvalidOperation error. Any suggestions what to try next?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#10 Dec. 11, 2010 15:18:11

L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django session InvalidOperation


Hard to know from what's shown here, but it seems likely that your
database didn't get created properly on the new server. The error
suggests that the expire_date column of the django_session table in
the MySQL database is of type DECIMAL rather than the expected
DATETIME. How did you migrate the database to the new server? It's
best to use mysqldump and not simply copy the data files when you're
changing MySQL versions.

On Dec 11, 12:31 pm, kinder <ad...@indermaur.com> wrote:
> I'm stumped... even removing mod_php from the apache config (which is
> where I suspected a different mysql shared library), I still get the
> same InvalidOperation error. Any suggestions what to try next?

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 18th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support