Ember-simple-auth-token / Flask error: AttributeError: 'function' object has no attribute 'get'
Ember-simple-auth-token / Flask error: AttributeError: 'function' object has no attribute 'get'
我正在尝试 运行 一个 Ember 项目,我不得不升级它的包,但现在我 运行 遇到了弃用问题。
我当前的问题是,当我按 'login' 时,我看到以下错误客户端:
http://127.0.0.1:8000/api/token-auth/
[HTTP/1.0 500 INTERNAL SERVER ERROR 48ms]
服务器端:
127.0.0.1 - - [21/Jun/2016 00:38:52] "POST /api/token-auth/ HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1559, in handle_exception
handler = self._find_error_handler(InternalServerError())
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1476, in _find_error_handler
.get(code))
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1465, in find_handler
handler = handler_map.get(cls)
AttributeError: 'function' object has no attribute 'get'
登录脚本app/controllers/login.js
:
import Ember from 'ember';
export default Ember.Controller.extend({
session: Ember.inject.service(),
loginMessage: "",
actions: {
authenticate: function() {
var credentials = this.getProperties('identification', 'password'),
authenticator = 'authenticator:jwt';
this.set("loginMessage", "");
this.get('session').authenticate(authenticator, credentials);
}
}
});
登录脚本取自https://github.com/jpadilla/ember-simple-auth-token,可能未完全更新。我已将 ember 从版本 1.13.13
更新到 2.6.0
。
最初看起来像这样:
import Ember from 'ember';
export default Ember.Controller.extend({
loginMessage: "",
actions: {
authenticate: function() {
var credentials = this.getProperties('identification', 'password'),
authenticator = 'simple-auth-authenticator:jwt';
this.set("loginMessage", "");
this.get('session').authenticate(authenticator, credentials);
}
}
});
我真的不了解 Ember,所以据我所知,有一个构建 javascript 文件是基于 javascript 小文件的 MCR 架构。
Python2-烧瓶版本是0.11-2
如果需要任何其他信息,请说明。
我必须 add/edit 以下内容:
./config/environment.js
ENV['ember-simple-auth'] = {
authorizer: 'authorizer:token',
crossOriginWhitelist: [ENV.APP.krakenHost]
};
ENV['ember-simple-auth-token'] = {
serverTokenEndpoint: ENV.APP.krakenHost+'/api/token',
serverTokenRefreshEndpoint: ENV.APP.krakenHost+'/api/token/refresh',
refreshAccessTokens: true,
timeFactor: 1000,
refreshLeeway: 300
};
这在我执行 ember init
后被删除,但即使在删除之前它也会出现此错误,因为环境和授权方名称已过时。
我正在尝试 运行 一个 Ember 项目,我不得不升级它的包,但现在我 运行 遇到了弃用问题。
我当前的问题是,当我按 'login' 时,我看到以下错误客户端:
http://127.0.0.1:8000/api/token-auth/
[HTTP/1.0 500 INTERNAL SERVER ERROR 48ms]
服务器端:
127.0.0.1 - - [21/Jun/2016 00:38:52] "POST /api/token-auth/ HTTP/1.1" 500 -
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1559, in handle_exception
handler = self._find_error_handler(InternalServerError())
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1476, in _find_error_handler
.get(code))
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1465, in find_handler
handler = handler_map.get(cls)
AttributeError: 'function' object has no attribute 'get'
登录脚本app/controllers/login.js
:
import Ember from 'ember';
export default Ember.Controller.extend({
session: Ember.inject.service(),
loginMessage: "",
actions: {
authenticate: function() {
var credentials = this.getProperties('identification', 'password'),
authenticator = 'authenticator:jwt';
this.set("loginMessage", "");
this.get('session').authenticate(authenticator, credentials);
}
}
});
登录脚本取自https://github.com/jpadilla/ember-simple-auth-token,可能未完全更新。我已将 ember 从版本 1.13.13
更新到 2.6.0
。
最初看起来像这样:
import Ember from 'ember';
export default Ember.Controller.extend({
loginMessage: "",
actions: {
authenticate: function() {
var credentials = this.getProperties('identification', 'password'),
authenticator = 'simple-auth-authenticator:jwt';
this.set("loginMessage", "");
this.get('session').authenticate(authenticator, credentials);
}
}
});
我真的不了解 Ember,所以据我所知,有一个构建 javascript 文件是基于 javascript 小文件的 MCR 架构。
Python2-烧瓶版本是0.11-2
如果需要任何其他信息,请说明。
我必须 add/edit 以下内容:
./config/environment.js
ENV['ember-simple-auth'] = {
authorizer: 'authorizer:token',
crossOriginWhitelist: [ENV.APP.krakenHost]
};
ENV['ember-simple-auth-token'] = {
serverTokenEndpoint: ENV.APP.krakenHost+'/api/token',
serverTokenRefreshEndpoint: ENV.APP.krakenHost+'/api/token/refresh',
refreshAccessTokens: true,
timeFactor: 1000,
refreshLeeway: 300
};
这在我执行 ember init
后被删除,但即使在删除之前它也会出现此错误,因为环境和授权方名称已过时。