簡體   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