"Fix" python2.x version of Django under Admin Administration page CSS is invalid

Source: Internet
Author: User

Toss an afternoon, finally solved the problem, it is necessary to record, I wonder why the lab computer is not a problem, to the dorm is hanging off, hum

The main is to change the Mimetypes file, located under D:\MySoftware\Python27\Lib

1. Add code

"default_encoding = sys.getdefaultencoding ()" found in the mimetypes.py file

Add on top of the code

if ' Utf-8 ' :    Reload (SYS) sys.setdefaultencoding ('utf-8')

2. Comment Code

About 248 lines in mimetypes.py, find the code and annotate it, as follows

defenum_types (mimedb): I=0 whileTrue:Try: CType=_winreg. EnumKey (Mimedb, i)exceptEnvironmentError: Break                #Try:                 #CType = Ctype.encode (default_encoding) # Omit in 3.x!                #except Unicodeencodeerror:                 #Pass                #Else:                    yieldCType I+ = 1

And then, finally, I can write Python happily under the win8 under my little laptop.

"Fix" python2.x version of Django under Admin Administration page CSS is invalid

Related Article

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.