I am deploying my Django project on Windows Azure. I was using SQLite as a database server and everything was ok. When I have deployed My project, I decided to connect it with an SQL Azure Database but it seems that this solution created some errors. I am no longer able to edit users profiles. I get always this error : AttributeError at /admin/auth/user/1/ 'unicode' object has no attribute 'tzinfo'
相关问题
- Django __str__ returned non-string (type NoneType)
- Django & Amazon SES SMTP. Cannot send email
- Django check user group permissions
- Django restrict pages to certain users
- UnicodeEncodeError with attach_file on EmailMessag
相关文章
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- SQL Azure Reset autoincrement
- Django is sooo slow? errno 32 broken pipe? dcramer
- Django: Replacement for the default ManyToMany Wid
- Upgrading transaction.commit_manually() to Django
This error happens when your database contains date-time stamps like this:
0000-00-00 00:00:00.000000
(this can happen in MySQL if you delete or overwrite a previous date with MySQLWorkbench)
When you try to retrieve these records in a Django model object, you will get an exception from the pytz timezone library:
You should edit these dates in your database first, and set them to more recent dates, like
2018-01-01 00:00:00.000000
or set toNULL
(but not blank).See:
See also:
I had same issue trying to use
django-pyodbc-azure
database backend with Django (1.5.1): by default it storesDateTimeField
fields in your DB asdatetime2(7)
, which looks to be still unsupported in Django. In my case I added the option'use_legacy_datetime' : True
insettings.py
, like below:I found my solution here. I don't know Azure platform well, so I don't know if this is exactly your case, if not you can still modify your database replacing
datetime2(N)
fields with good olddatetime
ones.Hope it helps.