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