安装和使用的django的debug_toolbar
2016-05-24 09:20
417 查看
安装和使用的django的debug_toolbar
Django Debug Toolbar安装
安装Django Debug Toolbarpip install django-debug-toolbar
将debug_toolbar复制到项目根目录下,打开项目settings.py,首先确保
DEBUG = True
找到INSTALLED_APPS,添加:
'debug_toolbar',, 找到MIDDLEWARE_CLASSES,添加:
'debug_toolbar.middleware.DebugToolbarMiddleware',
在settings.py末尾添加设置项INTERNAL_IPS,用以设置允许访问debug_toolbar的IP地址
INTERNAL_IPS = ('127.0.0.1',)
报错及解决
运行后发现报错:'module' object has no attribute 'getrusage'
这个是它的timer出问题了,直接注释掉
PANELS_DEFAULTS = [ 'debug_toolbar.panels.versions.VersionsPanel', # #Throwing AttributeError: 'module' object has no attribute 'getrusage' #'debug_toolbar.panels.timer.TimerDebugPanel', 'debug_toolbar.panels.settings.SettingsPanel', 'debug_toolbar.panels.headers.HeadersPanel', 'debug_toolbar.panels.request.RequestPanel', 'debug_toolbar.panels.sql.SQLPanel', 'debug_toolbar.panels.staticfiles.StaticFilesPanel', 'debug_toolbar.panels.templates.TemplatesPanel', 'debug_toolbar.panels.cache.CachePanel', 'debug_toolbar.panels.signals.SignalsPanel', 'debug_toolbar.panels.logging.LoggingPanel', 'debug_toolbar.panels.redirects.RedirectsPanel', ]
再运行还是不行,看文件加载得知jquery.min.js没有被加载成功。这就是问题所在。
去debug_toolbar的settings里面一看:
'JQUERY_URL': '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js',
我大天朝必然是不行的吗, 如果项目中有jquery直接注释掉这行,否则就改成其他的可用的地址
DEBUG_TOOLBAR_CONFIG = { 'JQUERY_URL' : r"http://code.jquery.com/jquery-2.1.1.min.js"}
然而并没有什么卵用啊
相关文章推荐
- 快速学习django
- google的RPC框架:grpc 介绍
- 森果SENGO开创婚礼产业共享经济时代
- django rest framework
- HDU 4362 Dragon Ball 贪心DP
- 百度经纬度和google经纬度转换测试
- 2.django笔记之缓存,session,cookie,ajax
- django
- 使用uWSGI部署django项目
- 人脸识别算法准确率最终超过了人类 The Face Recognition Algorithm That Finally Outperforms Humans
- fonts.googleapis.com 加载慢的解决方法
- django处理静态文件
- 文笔很差系列1 - 也谈谈AlphaGo
- Go Benchmarks
- flask-pymongo部分基础返回数据
- Django forms 关于select和checkbox设置初始选中值
- Google推荐的图片加载库Glide介绍
- Google推荐的图片加载库Glide与Picasso介
- [Ubuntu]How to install Google Chrome in Ubuntu
- google guava使用例子/示范(一)