Django error: django.db.utils.DatabaseError: You mustnot use 8-bit bytesrings

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imhomer
    New Member
    • Feb 2012
    • 11

    Django error: django.db.utils.DatabaseError: You mustnot use 8-bit bytesrings

    When I run "python manage.py syncdb" and after I input that I want to create a superuser, cmd told me the error below:

    django.db.utils .DatabaseError: You mustnot use 8-bit bytesrings unless you use a text_factory that can interpret 8-bit bytestings (like text_factory = str). It is highly recommend that you instead just switch your application to Unicode strings.

    Could you help me solve the problem? Thanks!
  • Smygis
    New Member
    • Jun 2007
    • 126

    #2
    I don't know if its enough to add
    Code:
    #coding: UTF-8
    at the top of the program. Or if there is some other setting you need to change. Or you could convert the string to unicode using:
    Code:
    unicode(string) #or when you create the string:
    a = u"string"

    Comment

    • imhomer
      New Member
      • Feb 2012
      • 11

      #3
      I changed the settings of region in control panel and it worked. Thanks all the same!

      Comment

      Working...