Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 让应用程序引擎模块正常工作_Python_Google App Engine_Python 2.7_Module - Fatal编程技术网

Python 让应用程序引擎模块正常工作

Python 让应用程序引擎模块正常工作,python,google-app-engine,python-2.7,module,Python,Google App Engine,Python 2.7,Module,我正在学习Google应用程序引擎模块,但我似乎无法让它们在dev_appserver上运行,甚至无法下载和使用它们的应用程序 根据示例应用程序,发送到/work或/mobile的所有请求都将被发送到相应的模块 但是,当我向http://localhost:8080/work或http://localhost:8080/mobile,它返回一个404 我使用命令行启动dev_appserver: dev_appserver.py appengine-modules-helloworl

我正在学习Google应用程序引擎模块,但我似乎无法让它们在dev_appserver上运行,甚至无法下载和使用它们的应用程序

根据示例应用程序,发送到
/work
/mobile
的所有请求都将被发送到相应的模块

但是,当我向
http://localhost:8080/work
http://localhost:8080/mobile
,它返回一个404

我使用命令行启动dev_appserver:

dev_appserver.py appengine-modules-helloworld-python-master
我得到:

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
根据文档,我应该看到更多的线路告诉我,其他模块正在不同的端口上启动,但我不知道为什么

然后,如果我运行以下代码:

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)
其结果是:

Hello, webapp2 World!
['default']
localhost:8080
就好像没有加载非默认模块一样

设置模块并使其在本地开发服务器和生产环境中工作的正确方法是什么


谢谢

您在yaml文件中有错误的应用程序名称。这些名称应该与在
dev_appserver.py
命令中启动本地服务器时使用的名称相匹配:
appengine modules helloworld python master
。在命令或yaml文件中切换,使其匹配

您还需要启动dev服务器中的模块:


dev_appserver.py dispatch.yaml app.yaml mobile_frontend.yaml static_backend.yaml

您必须发布您的yaml文件,以便我们提供帮助。该示例具有/work和/mobile的url处理程序。对不起,我错了。是的,它是/工作和/移动的。所以问题是,对于那些YAML文件,为什么当我调用这两个URL时,它返回404而不是路由到模块的请求?信息不够。当您转到
http://localhost:8080
,你得到了什么?你能发布你的其他yaml文件吗,包括dispatch.yaml?我已经编辑了帖子并添加了所有细节。看起来dev_appserver没有启动模块…仍然需要查看yaml文件。好的,我将应用程序目录名称更改为“simple sample”,使其与yaml文件中的应用程序名称相同。我运行了
dev_appserver.py simple sample
,得到了与以前相同的结果。当我向上面的URL/work或/mobile发送请求时,启动日志中没有初始化模块。返回404。谢谢!我不知道您必须将yaml文件添加到dev_appserver参数中。现在工作!再次感谢!