python - Django failed to insert record into session after login -


django failed insert record session after login message: -------------------------------------------------------------------- databaseerror @ /admin/ (-2147352567, 'exception occurred.', (0, u'microsoft ole db provider sql server', u'conversion failed when converting date and/or time character string.', none, 0, -2147217913), none)  command: insert [django_session] ([session_key], [session_data], [expire_date]) values (?, ?, ?)  parameters: [name: p0, dir.: input, type: adbstr, size: 32, value: "orctnepzkaqb4haa6tn7jjit961a4l3s", precision: 0, numericscale: 0, name: p1, dir.: input, type: adbstr, size: 60, value: "m2fimtm4ngjmnjy4ndc2yja0y2i1zji4ndcxyznlntexytljodyxmtp7fq==", precision: 0, numericscale: 0, name: p2, dir.: input, type: adbstr, size: 26, value: "2014-12-30t12:38:53.076000", precision: 0, numericscale: 0] -------------------------------------------------------------------- 

if @ date of 2014-12-30t12: 38: 53.076000 shows milliseconds composed of 6 digits.

direct insert database same parameters returns same error of conversion.

if truncate milliseconds 3 characters, insertion occur normally.

where , when django creates date in format?

this error occurs on production environment. python 2.7, django 1.6.8, os: windows server 2008r2, web server: iis 7, db server: ms sql 2008r2

you can try settings datetime_input_formats in settings.py

more in docs

try like:

datetime_input_formats = (     '%y-%m-%d %h:%m:%s',    ) 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -