I've already created a basic CMS and my next step is to add image upload functionality. I've added some lines to my models.py and after that my model is not validating because of UnicodeDecodeError:
Unhandled exception in thread started by
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 93, in w
rapper
fn(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 101, in inner_run
self.validate(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 310,
in validate
num_errors = get_validation_errors(s, app)
File "C:\Python27\lib\site-packages\django\core\management\validation.py", lin
e 113, in get_validation_errors
from django.utils.image import Image
File "C:\Python27\lib\site-packages\django\utils\image.py", line 154, in
Image, _imaging, ImageFile = _detect_image_library()
File "C:\Python27\lib\site-packages\django\utils\image.py", line 134, in _dete
ct_image_library
"imported: %s") % err
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 168, in
__mod__
return six.text_type(self) % rhs
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 35: ordinal
not in range(128)
Here is my models.py code:
from django.db import models
from django.contrib.auth.models import User
...
class Photo(models.Model):
title = models.CharField(max_length=255)
upload_path = '/'
photo = models.ImageField(upload_to=upload_path)
def __unicode__(self):
return self.title
I've got Python 2.7.6, Django 1.6.1, MySQL-python-1.2.3.
Does anybody know why the exception occurs?