Xadmin setting "Use_bootswatch = True" is not valid for workaround

Source: Internet
Author: User

Environment:

    • Python 2.7
    • Django 1.9
    • Xadmin introduced into the project in the form of source code

Problem:

    • In the process of using xadmin, set "Use_bootswatch = True" to try to bring up the theme menu and display more topics. However, after setting up, the Discovery topic is still the default and BOOTSTRAP2, in-depth tracking source code, found/xadmin/plugins/themes.py under the block_top_navmenu method, in Use_bootswatch= True, you will use HTTPLIB2 to load http://bootswatch.com/api/3.json This URL, but will be wrong, the cause of the error is not known, but we can use the requests Library to solve this problem.

Solve:

    • First install the Requests library
PIP Install requests
    • Second, introduce requests in the/xadmin/plugins/themes.py source file

    • Finally, we will revise the contents of the method Block_top_navmenu in this file, the part of the middle circle, corresponding to the modification:

Then after the modification, the problem was solved.

Xadmin setting "Use_bootswatch = True" is not valid for workaround

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.