繁体   English   中英

具有GAE的Ninja框架:访问Google App Engine开发控制台

[英]Ninja framework with GAE: accessing the google app engine development console

通过Ninja框架使用GAE时,我似乎无法访问通常位于http:localhost:8080/_ah/admin的开发控制台。 这是允许您查看数据存储,日志等的控制台。我如何访问它?

因此,我通过查看ninja-appengine github自述文件中提供的示例ninja-appengine应用程序解决了此问题。 我注意到他们的示例应用程序没有遇到相同的问题,这是由于包含了我所缺少的conf / ServletModule.java文件。 下面的代码有两件事:

它通过Java代码插入一个Objectify过滤器,而不是要求通过web.xml包含objectify过滤器。

其次,在开发环境中运行时,它使_ah / admin路径可见。 注意,我只是复制了示例ninja-appengine Web应用程序中给出的代码:

软件包conf;

导入ninja.servlet.NinjaServletDispatcher;

导入com.google.appengine.api.utils.SystemProperty; 导入com.google.inject.Singleton; 导入com.googlecode.objectify.ObjectifyFilter;

公共类ServletModule扩展了com.google.inject.servlet.ServletModule {

@Override
protected void configureServlets() {

    bind(NinjaServletDispatcher.class).asEagerSingleton();

    // Clean objectify instances with that filter:
    bind(ObjectifyFilter.class).in(Singleton.class);
    filter("/*").through(ObjectifyFilter.class);

    if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {

        serve("/*").with(NinjaServletDispatcher.class);

    } else {
        // do not serve admin stuff like _ah and so on...
        // allows to call /_ah/admin and so on
        serveRegex("/(?!_ah).*").with(NinjaServletDispatcher.class);
    }

}

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM