Python27+django Database Configuration FAQs

Source: Internet
Author: User

MySQL lacks the module, needs to install, recommends to go to http://sourceforge.net/projects/mysql-python/files/mysql-python/under the source code compiles, or installs the MSI File/HTTP/ www.codegood.com/archives/129

Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xe5 in position 108:ordinal not in range (128)

Solve:

SYSReload(sys)sys.  Setdefaultencoding(' UTF8 ')

Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xb2 in position 0:ordinal No in range workaround

Open the mimetypes.py file under the C:\Python27\Lib folder to find about 256 lines of

' default_encoding = sys.getdefaultencoding () '.

Add three lines in front of this line

If sys.getdefaultencoding ()! = ' GBK ':

Reload (SYS)

Sys.setdefaultencoding (' GBK ')

default_encoding = sys.getdefaultencoding ()

Note that the above is UTF8, the following also must be UTF8, Chinese encoding format to be consistent

Django.core.exceptions.ImproperlyConfigured:Error loading MySQLdb module:dll load failed:%1 is not a valid WIN32 application.

This is because you installed a 64-bit Python and then installed a 32-bit MySQL module, or you installed a 32-bit Python, and then installed the 64-bit MYQL module

Python27+django Database Configuration FAQs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.