2012-03-02 11 views
0

だから私はGoogleのApp Engineデータストアのintroducitonのための基本的なチュートリアルのコードを実行していた。何か私のFacebookにアクセスしようとしましたか?

import cgi 
import datetime 
import urllib 
import webapp2 

from google.appengine.ext import db 
from google.appengine.api import users 


class Greeting(db.Model): 
    """Models an individual Guestbook entry with an author, content, and date.""" 
    author = db.UserProperty() 
    content = db.StringProperty(multiline=True) 
    date = db.DateTimeProperty(auto_now_add=True) 


def guestbook_key(guestbook_name=None): 
    """Constructs a datastore key for a Guestbook entity with guestbook_name.""" 
    return db.Key.from_path('Guestbook', guestbook_name or 'default_guestbook') 


class MainPage(webapp2.RequestHandler): 
    def get(self): 
     self.response.out.write('<html><body>') 
     guestbook_name=self.request.get('guestbook_name') 

     # Ancestor Queries, as shown here, are strongly consistent with the High 
     # Replication datastore. Queries that span entity groups are eventually 
     # consistent. If we omitted the ancestor from this query there would be a 
     # slight chance that Greeting that had just been written would not show up 
     # in a query. 
     greetings = db.GqlQuery("SELECT * " 
           "FROM Greeting " 
           "WHERE ANCESTOR IS :1 " 
           "ORDER BY date DESC LIMIT 10", 
      guestbook_key(guestbook_name)) 

     for greeting in greetings: 
      if greeting.author: 
       self.response.out.write(
        '<b>%s</b> wrote:' % greeting.author.nickname()) 
      else: 
       self.response.out.write('An anonymous person wrote:') 
      self.response.out.write('<blockquote>%s</blockquote>' % 
            cgi.escape(greeting.content)) 

     self.response.out.write(""" 
      <form action="/sign?%s" method="post"> 
      <div><textarea name="content" rows="3" cols="60"></textarea></div> 
      <div><input type="submit" value="Sign Guestbook"></div> 
      </form> 
      <hr> 
      <form>Guestbook name: <input value="%s" name="guestbook_name"> 
      <input type="submit" value="switch"></form> 
     </body> 
     </html>""" % (urllib.urlencode({'guestbook_name': guestbook_name}), 
        cgi.escape(guestbook_name))) 


class Guestbook(webapp2.RequestHandler): 
    def post(self): 
     # We set the same parent key on the 'Greeting' to ensure each greeting is in 
     # the same entity group. Queries across the single entity group will be 
     # consistent. However, the write rate to a single entity group should 
     # be limited to ~1/second. 
     guestbook_name = self.request.get('guestbook_name') 
     greeting = Greeting(parent=guestbook_key(guestbook_name)) 

     if users.get_current_user(): 
      greeting.author = users.get_current_user() 

     greeting.content = self.request.get('content') 
     greeting.put() 
     self.redirect('/?' + urllib.urlencode({'guestbook_name': guestbook_name})) 


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

Pycharm以内に私は上記のコードを実行するために、「シフト+ F10」を押してください。

サイトは127.0.0.1:8080で開く前に、私は次のログを取得する:

C:\Python27\python.exe "C:/Program Files/Google/google_appengine/dev_appserver.py" .

WARNING 2012-03-02 01:34:41,374 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.

INFO 2012-03-02 01:34:41,976 appengine_rpc.py:160] Server: appengine.google.com

INFO 2012-03-02 01:34:41,983 appcfg.py:581] Checking for updates to the SDK.

INFO 2012-03-02 01:34:44,369 appcfg.py:599] The SDK is up to date.

WARNING 2012-03-02 01:34:44,371 datastore_file_stub.py:513] Could not read datastore data from c:\users\robert\appdata\local\temp\dev_appserver.datastore

INFO 2012-03-02 01:34:46,295 dev_appserver_multiprocess.py:650] Running application dev~helloworld on port 8080: http://localhost:8080

INFO 2012-03-02 01:34:46,296 dev_appserver_multiprocess.py:652] Admin console is available at: http://localhost:8080/_ah/admin

WARNING 2012-03-02 01:34:47,480 py_zipimport.py:139] Can't open zipfile C:\Python27\lib\site-packages\pyfacebook-1.0a2-py2.7.egg: IOError: [Errno 13] file not accessible: 'C:\Python27\lib\site-packages\pyfacebook-1.0a2-py2.7.egg'

INFO 2012-03-02 01:34:49,108 datastore_stub_index.py:257] Updating C:\Users\Robert\PycharmProjects\helloworld\index.yaml

INFO 2012-03-02 01:34:49,148 dev_appserver.py:2865] "GET/ HTTP/1.1" 200 -

INFO 2012-03-02 01:34:49,315 dev_appserver.py:2865] "GET /favicon.ico HTTP/1.1" 404 -

注ログはラインを持っています

WARNING 2012-03-02 1:34: Python27 \ lib \ site-packages \ pyfacebook-1.0a2-py2.7.egg:IOError:[Errno 13]ファイルにアクセスできません: 'C:\ Python27 \ lib \ site-packages \ pyfacebook-1.0a2-py2.7.egg '

私は確かに理由があると確信していますこれについての論理的な説明は誰でも知っていますか?

+0

ファイルは実際にそこにありますか? –

+0

はいpyfacebook-1.0a2-py2.7.eggはそのディレクトリにあります。 –

答えて

1

確かにわかりませんが、パス/インストールの競合のような "匂い"があります。おそらく、App Engineはそれをアクセスできない場所(他のPythonのインストールでおそらく?)でパッケージを見つけています。インタラクティブなPythonシェルからパッケージをインポートすることができれば、そのファイルは正しいパーミッションを持っています。その場合は、複数のインストール/インストールパスを確認してください。私の場合、「システム」のPythonには何かがインストールされていましたが、App Engineが使用していたものはありませんでした。

+0

ありがとう、私はそれを試してみよう –

関連する問題