Python Google应用程序引擎dev_appserver.py问题
我刚开始使用google app engine,我遵循了google app engine上的基本hello world示例 在helloworld文件夹中创建了这两个文件 我不想使用GUI,我更喜欢使用mac终端来处理这个应用程序。我想通过终端在本地主机localhost:80上启动此应用程序 要在本地运行我的基本helloworld应用程序,我要说的就是 $dev_appserver.py helloworld。但我得到了这个错误Python Google应用程序引擎dev_appserver.py问题,python,google-app-engine,Python,Google App Engine,我刚开始使用google app engine,我遵循了google app engine上的基本hello world示例 在helloworld文件夹中创建了这两个文件 我不想使用GUI,我更喜欢使用mac终端来处理这个应用程序。我想通过终端在本地主机localhost:80上启动此应用程序 要在本地运行我的基本helloworld应用程序,我要说的就是 $dev_appserver.py helloworld。但我得到了这个错误 Traceback (most recent call l
Traceback (most recent call last):
File "/usr/local/bin/dev_appserver.py", line 184, in <module>
_run_file(__file__, globals())
File "/usr/local/bin/dev_appserver.py", line 180, in _run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 727, in <module>
main()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 720, in main
dev_server.start(options)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 554, in start
options.yaml_files)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 556, in __init__
module_configuration = ModuleConfiguration(yaml_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 82, in __init__
self._yaml_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 271, in _parse_configuration
with open(configuration_path) as f:
IOError: [Errno 2] No such file or directory: 'helloworld'
还有helloworld.py
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, World!')
application = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)
我也有同样的问题。经过一番努力,在
google\u appengine
目录中而不是helloword
目录中,对我有效的命令是:
python dev_appserver.py helloworld/
也许这有帮助
dev_appserver.py
使用/usr/local/bin文件夹中的符号链接安装google cloud sdk后,您是否运行了
gcloud components install app-engine-go
文件在组织上有点荒谬。当我第一次从…\Google\Cloud SDK\Google Cloud SDK\bin目录启动时,我完全没有注意到这一点: 而不是:
dev_appserver.py YOUR_DIRECTORY
尝试:
或:
创建一个目录testdir 在此目录中提取google cloud sdk 在testdir目录内创建另一个目录“helloworld” 从中创建两个文件后 在helloworld目录中 在终端: 转到testdir目录
运行:
googlecloudsdk/bin/dev_appserver.py helloworld/
错误显示没有文件或目录。helloworld目录是否存在于您运行命令的目录中,并且其中是否有app.yaml?事实上,我用其中的两个文件更新了我的帖子。在运行dev_appserver.py之前,我确保将cd放入目录中,但仍然不行。如果将cd放入helloworld
目录,则命令应为dev_appserver.py。
参数是指向包含app.yaml的目录的路径。如果您在该目录中,则路径是当前目录的完整路径或
gcloud components install app-engine-go
dev_appserver.py YOUR_DIRECTORY
py dev_appserver.py YOUR_DIRECTORY
python dev_appserver.py YOUR_DIRECTORY