我有一个使用AngularJS编写的单页Web应用程序.它使用PouchDB复制到CouchDB服务器并且工作正常.
当我尝试通过添加cache.manifest将网页转换为可脱机时,问题就来了.突然间,所有复制任务都会抛出错误并停止工作,无论是脱机还是在线工作.
在Chrome中它只是说"GET ... myCouchIP/myDB /?_ nonce = CxVFIwnEJeGFcyoJ net :: ERR_FAILED"
在Firefox中它也会抛出错误,但提到请求被阻止 - 尝试启用CORS.
根据PouchDB设置页面的说明,在远程CouchDB上启用CORS.另外,它没有使用cache.manifest工作正常(即它对我的桌面,服务器和VM之间的所有不同的IP地址非常满意 - 它是原型,因此此时没有域名).
顺便说一句,此时我没有使用任何类型的身份验证.管理员方生效.
那么在添加cache.manifest时会发生什么变化?线索感激不尽.提前致谢.
app.js
var app = angular.module('Assets', ['assets.controllers', 'ngRoute']);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/', {
controller: 'OverviewCtrl',
templateUrl: 'views/overview.html'
}).
when('/new', {
controller: 'NewMachineCtrl',
templateUrl: 'views/machineForm.html'
}).
otherwise({redirectTo: '/'});
}]);
Run Code Online (Sandbox Code Playgroud)
controller.js
var _control = angular.module('assets.controllers', ['assets.services']);
_control.controller('OverviewCtrl', ['$scope', 'Machine', function($scope, Machine) {
var promise = Machine.getAll();
promise.then(function(machineList) {
$scope.machines = machineList;
}, function(reason) {
alert('Machine list is empty: ' + reason);
}); …Run Code Online (Sandbox Code Playgroud) 我对Python和Google App Engine都很陌生,我正在慢慢地尝试解决以下编译错误.
文件"/opt/google/google_appengine/google/appengine/tools/appengine_rpc.py" 26行,在进口cookielib文件"/usr/lib/python2.7/cookielib.py" 38行,从日历进口timegm ImportError:无法导入名称timegm
我正在使用Eclipse中的PyDev插件进行本地部署.据我所知,没有理由错误.我已经尝试将timegm.py文件夹添加到PYTHONPATH配置中,我甚至通过from calendar import timegm在我的代码中使用auto complete 导入证明了这一点!
我见过其他人有问题,但没有解决方案.有人知道怎么修这个东西吗?
代码如下:
import httplib2
import webapp2
from apiclient.discovery import build
from google.appengine.api import oauth
from oauth2client.client import OAuth2WebServerFlow
from urlparse import urlparse, parse_qs
class MainPage(webapp2.RequestHandler):
def get(self):
flow = OAuth2WebServerFlow(__CLIENT_ID, __CLIENT_SECRET, _SCOPE, _REDIRECT_URI)
authUri = flow.step1_get_authorize_url()
queryString = parse_qs(urlparse(authUri).query)
if 'error' not in queryString:
# Create an httplib2.Http object to handle our HTTP requests and authorize it
credentials = flow.step2_exchange(queryString['code'])
http = httplib2.Http()
http = …Run Code Online (Sandbox Code Playgroud)