By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,604 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,604 IT Pros & Developers. It's quick & easy.

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

P: 11
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!
Mar 6 '12 #1

✓ answered by Smygis

I don't know if its enough to add
Expand|Select|Wrap|Line Numbers
  1. #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:
Expand|Select|Wrap|Line Numbers
  1. unicode(string) #or when you create the string:
  2. a = u"string"

Share this Question
Share on Google+
2 Replies

Smygis
100+
P: 126
I don't know if its enough to add
Expand|Select|Wrap|Line Numbers
  1. #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:
Expand|Select|Wrap|Line Numbers
  1. unicode(string) #or when you create the string:
  2. a = u"string"
Mar 6 '12 #2

P: 11
I changed the settings of region in control panel and it worked. Thanks all the same!
Mar 8 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.