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

126 Views Asked by At

When using GAE through the Ninja framework I cannot seem to access the development console usually located at http:localhost:8080/_ah/admin. This is the console that allows you to view the datastore, logs, etc. How could I access it?

1

There are 1 best solutions below

0
On

So I solved this by looking at the sample ninja-appengine application presented in the ninja-appengine github readme. I noticed that their sample app did not suffer from the same issue and it is due to the inclusion of the conf/ServletModule.java file which I was missing. The code below does two things:

it inserts an Objectify Filter through Java code rather than requiring that the objectify filter be included via the web.xml.

Secondly it makes the _ah/admin paths visible when running in a dev environment. Note, I have just copied in the code given in the sample ninja-appengine web application:

package conf;

import ninja.servlet.NinjaServletDispatcher;

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

public class ServletModule extends 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);
    }

}

}