I'm learning about Google App Engine modules, but I can't seem to get them running on the dev_appserver, not even by downloading and using their sample application.
According to the sample application, all requests sent to /work or /mobile would be dispatched to the corresponding module.
However, when I send request to http://localhost:8080/work or http://localhost:8080/mobile, it returns a 404.
I start the dev_appserver using the command line:
dev_appserver.py appengine-modules-helloworld-python-master
And I get:
INFO 2014-06-23 09:39:16,375 sdk_update_checker.py:242] Checking for updates to the SDK.
INFO 2014-06-23 09:39:16,673 sdk_update_checker.py:286] This SDK release is newer than the advertised release.
WARNING 2014-06-23 09:39:16,678 api_server.py:378] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2014-06-23 09:39:16,682 api_server.py:171] Starting API server at: http://localhost:61790
INFO 2014-06-23 09:39:16,686 dispatcher.py:182] Starting module "default" running at: http://localhost:8080
INFO 2014-06-23 09:39:16,692 admin_server.py:117] Starting admin server at: http://localhost:8000
According to documentation, I should be seeing more lines telling me that the other modules are being started on different ports, but I dont get that for some reason.
Then, if I run the following code:
import webapp2
from google.appengine.api import modules
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, webapp2 World!\n%s\n%s' % (modules.get_modules(), modules.get_hostname()))
APP = webapp2.WSGIApplication([('/', MainPage),], debug=True)
It results in:
Hello, webapp2 World!
['default']
localhost:8080
As if the non-default modules have not been loaded...
Whats the proper way of setting up module and making them work both on local development server as well as in production?
Thanks
You have the wrong app names in the yaml files. The names should match what you use when you start the local server in the dev_appserver.py command: appengine-modules-helloworld-python-master. Switch it in the command or the yaml files so they match.
You also need to startup the modules in the dev server:
dev_appserver.py dispatch.yaml app.yaml mobile_frontend.yaml static_backend.yaml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With