Note that there are some explanatory texts on larger screens.

plurals
  1. POgoogle app engine, webapp2, DomainRoute and lazy handlers
    text
    copied!<p>I'm trying to support a more or less isolated app inside my main GAE application, hosted at different subdomain.</p> <p>I put the handlers for this subdomain in the file "mediciones.py", inside the "oficina" folder.</p> <p>So I have:</p> <ol> <li>/main.py</li> <li>/oficina/mediciones.py</li> <li>And inside mediciones.py:</li> </ol> <pre class="lang-python prettyprint-override"><code>class Router(webapp2.RequestHandler): def get(self): [... code ...] class Listado(webapp.RequestHandler): def get(self): [... code ...] </code></pre> <p>Etc. for all the necessary handlers.</p> <p>Inside "main.py": </p> <pre><code>application = webapp2.WSGIApplication([ DomainRoute('ventas.domain.com', [webapp2.Route(r'/nueva', handler='oficina.mediciones.MedicionNueva', name="nueva-medicion"), webapp2.Route(r'/listado', handler="oficina.mediciones.Listado", name="listado-mediciones"), webapp2.Route(r'/medicion/(\d+)/', handler="oficina.mediciones.MedicionDetalles", name="detalles-mediciones"), webapp2.Route(r'/rellenar_medicion/(\d+)/', handler="oficina.mediciones.MedicionRellenar", name="rellenar-medicion"), webapp2.Route(r'/editar_medicion/(\d+)/', handler="oficina.mediciones.MedicionEditar", name="editar-medicion"), webapp2.Route('/', handler="oficina.mediciones.Router") ]), ('/(.+)', DirectView), ('/?', HomeView), ], debug=True) </code></pre> <p>But when I try to go to ventas.domain.com, or to ventas.domain.com/listado, I get this:</p> <pre><code>Traceback (most recent call last): File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1536, in __call__ rv = self.handle_exception(request, response, e) File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1530, in __call__ rv = self.router.dispatch(request, response) File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1272, in default_dispatcher self.handlers[handler] = handler = import_string(handler) File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1851, in import_string return getattr(__import__(module, None, None, [obj]), obj) ImportStringError: import_string() failed for 'oficina.mediciones.Router'. Possible reasons are: - missing __init__.py in a package; - package or module path not included in sys.path; - duplicated package or module name taking precedence in sys.path; - missing module, class, function or variable; Original exception: AttributeError: 'module' object has no attribute 'Router' Debugged import: - 'oficina' found in '/base/data/home/apps/s~pavimentos-arquiservi-web-hrd/11-0-0.361841284178483516/oficina/__init__.pyc'. - 'oficina.mediciones' found in '/base/data/home/apps/s~pavimentos-arquiservi-web-hrd/11-0-0.361841284178483516/oficina/mediciones/__init__.pyc'. - 'oficina.mediciones.Router' not found. </code></pre> <p>(Replace "Router" by "Listado", or the appropriate handler for each situation).</p> <p>Handlers are defined, but why isn't it finding them in their place?</p> <p>Thanks and regards.</p> <p>Iván</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload