私の GF はUdacity の Web 開発コースを受講しようとしていますが、問題が発生しました。そして、私はそれを解決することはできません。AppEngine で実行される "hello world" Python スクリプトを作成しなければならないのは、ほんの最初の段階です。
したがって、ファイルは次のとおりです。
app.yaml:
application: focus-invention-298
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld.app
helloworld.py:
# -*- coding: utf8 -*-
import webapp2
class MainPage(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Hello, Udacity!')
application = webapp2.WSGIApplication([('/', MainPage)], debug=True)
しかし、(GUI ランチャーまたは dev_appserver.py を使用して) アプリを実行し、ブラウザーでアプリを開くと、(コンソールで) 次のエラーが表示されます。
Traceback (most recent call last):
File "/Users/Kaja/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/Kaja/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
File "/Users/Kaja/Documents/udacity/helloworld.py", line 3
import webapp2
^
SyntaxError: invalid syntax
INFO 2013-08-05 14:06:00,875 module.py:595] default: "GET / HTTP/1.1" 500 -
ERROR 2013-08-05 14:06:01,012 wsgi.py:219]
Traceback (most recent call last):
File "/Users/Kaja/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/Kaja/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
File "/Users/Kaja/Documents/udacity/helloworld.py", line 3
import webapp2
^
SyntaxError: invalid syntax
私たちはOSX 10.8.4を使用しており、ターミナルでpythonを実行すると、2.7.2バージョンがインストールされていることがわかります。AppEngine ランチャー (または SDK) のバージョンは 1.8.2 です。
誰?私は成功せずに多くのことを試しましたが、もう何をすべきか本当にわかりません (私は Python 開発者ではありません)。私の GF が学習を継続できるように、このことを機能させたいと思っています :)