#说明:
- google的公共库国内访问不稳定
- 与将JS库存放在服务器单机上相比,CDN公共库更加稳定、高速。
##百度公共库
- [地址](http://developer.baidu.com/wiki/index.php?title=docs/cplat/libs)
- 百度公共CDN为您的应用程序提供稳定、可靠、高速的服务,包含全球所有最流行的开源JavaScript库
- 如果对版本要求不严,百度的公共库的确提供了一个很好的解决方案,不管从速度和稳定性方面都不错
- 百度CDN最明显的优势就是速度快
| import os |
| { | |
| // Your GitHub API token | |
| // see: https://github.com/condemil/Gist#generating-access-token | |
| "token": "b325b9d4af450496dfd6fbf338fe7a8bf5201da3", | |
| // Show GitHub organizations | |
| // Example: "company1", "company2" | |
| "include_orgs": [], | |
| // Show GitHub users |
#说明:
##百度公共库
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" > | |
| <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"> | |
| <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> | |
| <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> | |
| </head> |
| #coding=utf-8 | |
| import sys | |
| from django.conf import settings | |
| from django.conf.urls import patterns | |
| from django.http import HttpResponse | |
| from django.core.management import execute_from_command_line | |
| settings.configure( |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" > | |
| <link href="http://libs.baidu.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet"> | |
| <link href="http://cdn.bootcss.com/bootstrap/2.3.2/css/bootstrap-responsive.min.css" rel="stylesheet"> | |
| <script src="http://libs.baidu.com/jquery/1.8.2/jquery.min.js"></script> | |
| <script src="http://libs.baidu.com/bootstrap/2.3.2/js/bootstrap.min.js"></script> | |
| </head> |
| UpdateTime = urllib2.urlopen(u"http://zhihuhelpbyyzy-zhihu.stor.sinaapp.com/ZhihuHelpUpdateTime.txt",timeout=10) #线上总部 | |
| import webbrowser | |
| webbrowser.open_new_tab(url) #调用浏览器 |
| #coding:utf-8 | |
| #django test 中模拟登录的request | |
| from django.contrib.sessions.middleware import SessionMiddleware | |
| from django.test.client import RequestFactory | |
| def add_session_to_request(request): | |
| """Annotate a request object with a session""" | |
| middleware = SessionMiddleware() |
| # Settings that can be used when running inside of a docker container | |
| [hive] | |
| release = apache | |
| database = default | |
| warehouse_path = hdfs://hadoop:9000/edx-analytics-pipeline/warehouse/ | |
| [database-export] | |
| database = analytics | |
| #credentials = hdfs://hadoop:9000/edx-analytics-pipeline/output/local.json |
| def _update_with_kwargs(data_dict, **kwargs): | |
| """Updates a dict from kwargs only if it modifies a top-level value.""" | |
| for key, value in kwargs.iteritems(): | |
| if key in data_dict: | |
| data_dict[key] = value |