我正在开始新的Google App Engine应用程序,目前正在考虑两个框架:Flask和webapp2.我对我以前的App Engine应用程序使用的内置webapp框架非常满意,所以我认为webapp2会更好,我也不会有任何问题.
然而,Flask有很多好的评论,我真的很喜欢它的方法以及我在文档中到目前为止所读到的所有内容,我想尝试一下.但我有点担心我可以面对Flask的限制.
所以,问题是 - 你知道Flask可以带入Google App Engine应用程序的任何问题,性能问题,限制(例如路由系统,内置授权机制等)吗?"问题"是指我无法在几行代码(或任何合理数量的代码和工作)或完全不可能的事情中解决的问题.
作为一个后续问题:你认为Flask中是否有任何杀手级功能可以让我大吃一惊并让我使用它,尽管我可以面对任何问题?
鉴于一个功能,是否有可能得到它的名字?说:
func foo() {
}
func GetFunctionName(i interface{}) string {
// ...
}
func main() {
// Will print "name: foo"
fmt.Println("name:", GetFunctionName(foo))
}
Run Code Online (Sandbox Code Playgroud)
我被告知runtime.FuncForPC会有所帮助,但我不明白如何使用它.
我是Go的新手.从文档中尝试了第一个hello,world,并希望从请求中读取Host和Scheme:
package hello
import (
"fmt"
"http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Host: " + r.URL.Host + " Scheme: " + r.URL.Scheme)
}
Run Code Online (Sandbox Code Playgroud)
但他们的价值观都是空白的.为什么?
是否可以通过App Engine上的内置OpenId实现SSO?我一直在尝试集成Marketplace应用并让用户在使用Google Apps(管理面板或通用导航)时登录.我悲惨地失败了,现在我发现了这个:
"一个例外是混合OpenID/OAuth的应用程序 - 白名单目前不适用于这种方法." (从这里)
我假设我必须使用库实现OpenId,而不是使用内置的库在我的应用程序中使用Google Apps实现SSO?或者,如果可以使用内置的OpenId,是否有示例显示如何执行此操作?
对不起基本问题.我想把一个切片作为参数传递给fmt.Sprintf.像这样的东西:
values := []string{"foo", "bar", "baz"}
result := fmt.Sprintf("%s%s%s", values...)
Run Code Online (Sandbox Code Playgroud)
结果会是foobarbaz,但这显然不起作用.
(我想格式化的字符串比这更复杂,所以简单的连接不会这样做:)
所以问题是:如果我有数组,我怎么能把它作为单独的参数传递给fmt.Sprintf?或者:我可以在Go中调用一个传递参数列表的函数吗?
有人告诉我,使用App Engine服务(如数据存储区或memcache)的代码运行单元测试的最佳解决方案是在子进程中运行开发服务器,但我不确定如何.有人成功运行过这种测试并可以共享解决方案吗?
App Engine SDK for Go使用Python dev_appserver; 看到这个帖子.
你知道是否有一个Python库可以生成有关代码的统计信息吗?我正在考虑指向一个包并获取类,函数,方法,docblock行等的数量.
它最终可能包括像lambdas或其他疯狂统计数字这样无用的东西,只是为了好玩.
我正在以编程方式创建一个按钮.它是圆形的,有渐变背景,工作正常,看起来不错,但我不能做我想要的两件事:
作为参考,这是我正在使用的代码:
Button btn = new Button(context);
btn.setPadding(7, 3, 7, 5);
btn.setTextColor(text_color);
// Create a gradient for the button. Height is hardcoded to 30 (I don't know the height beforehand).
// I wish I could set the gradient aligned to the bottom of the button.
final Shader shader = new LinearGradient(0, 0, 0, 30,
new int[] { color_1, color_2 },
null, Shader.TileMode.MIRROR);
float[] roundedCorner = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 }
ShapeDrawable …Run Code Online (Sandbox Code Playgroud) 我目前遇到了Google AppEngine SDK的问题,其中使用的目录sys.path未经SDK识别其更改.需要重新启动SDK才能使修改后的文件生效.
这对于使用sys.path的框架尤其是一个问题,例如tipfy.
我正在尝试在从Google Apps市场安装的应用中检查用户是否是其Google Apps域的管理员.
我把它添加到manifest.xml:
<Scope id="Provisioning API">
<Url>https://apps-apis.google.com/a/feeds/user/#readonly</Url>
<Reason>This application can list domain users to give them permissions.</Reason>
</Scope>
Run Code Online (Sandbox Code Playgroud)
然后我设置一个测试处理程序让它工作:
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
import gdata.alt.appengine
import gdata.apps.service
import gdata.auth
# App id, key and secret from the Google Apps Marketplace.
APPLICATION_ID = 'XXX'
CONSUMER_KEY = 'XXX'
CONSUMER_SECRET = 'XXX'
class SetupHandler(webapp.RequestHandler):
def get(self, *args):
# The domain where this app is installed.
domain = 'my_customer_domain.com'
# A username to check.
username = 'webmaster'
sig_method = …Run Code Online (Sandbox Code Playgroud) google-app-engine provisioning google-apps google-apps-marketplace
go ×4
python ×3
google-apps ×2
android ×1
code-metrics ×1
flask ×1
format ×1
go-reflect ×1
httpserver ×1
openid ×1
provisioning ×1
reflection ×1
unit-testing ×1
webapp2 ×1