简体   繁体   English

Google App Engine Python 2.7教程错误

[英]Google App Engine Python 2.7 tutorial Error

I am following Google App Engine "Hello world" tutorial in this link: https://developers.google.com/appengine/docs/python/gettingstartedpython27/helloworld 我在此链接中关注Google App Engine“ Hello world”教程: https : //developers.google.com/appengine/docs/python/gettingstartedpython27/helloworld

I want to load my helloworld.py application: 我想加载helloworld.py应用程序:

import webapp2

class MainPage(webapp2.RequestHandler):
  def get(self):
      self.response.headers['Content-Type'] = 'text/plain'
      self.response.out.write('Hello, Udacity!')

app = webapp2.WSGIApplication([('/', MainPage)],
                              debug=True)

And I set the yaml file: 然后设置yaml文件:

application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.app

I am not using Google App Engine Launcher, just want to do everything in the console or command line. 我没有使用Google App Engine启动器,只是想在控制台或命令行中执行所有操作。

I want to start my helloworld app using dev_appserver.py --port=8888 helloworld , but the console complains AppConfigNotFoundError . 我想使用dev_appserver.py --port=8888 helloworld启动我的helloworld应用程序,但是控制台抱怨AppConfigNotFoundError The console outputs 控制台输出

C:\Documents and Settings\XXX\Desktop\helloworld>dev_appserver.py --port=8888
 helloworld
WARNING  2012-08-11 23:12:21,562 rdbms_mysqldb.py:74] The rdbms API is not avail
able because the MySQLdb library could not be loaded.
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 1
33, in <module>
    run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 1
29, in run_file
    execfile(script_path, globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\de
v_appserver_main.py", line 694, in <module>
    sys.exit(main(sys.argv))
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\de
v_appserver_main.py", line 582, in main
    root_path, {}, default_partition=default_partition)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\de
v_appserver.py", line 3217, in LoadAppConfig
    raise AppConfigNotFoundError
google.appengine.tools.dev_appserver.AppConfigNotFoundError

Would this be a path problem? 这会是路径问题吗? My helloworld.py and app.yaml is in a folder on my desktop and not in the google app engine directory. 我的helloworld.pyapp.yaml位于桌面上的文件夹中,而不位于Google App Engine目录中。

How can fix this error? 如何解决此错误? Any suggestion is appreciated! 任何建议表示赞赏!

Note: I am using Python 2.7 NOT 2.5. 注意:我使用的是Python 2.7 NOT 2.5。

When you call dev_appserver.py , the last argument should be the path to the directory that your app.yaml is in. In your case, since you are running from within your project's directory, you can just use dev_appserver.py --port=8888 . 调用dev_appserver.py ,最后一个参数应该是app.yaml所在目录的路径。在这种情况下,由于您是从项目目录中运行的,因此只能使用dev_appserver.py --port=8888 . , because . 因为. is short for the current directory. 是当前目录的缩写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM