Frage

I have an app that works using dev_appserver.py on my machine. I deploy it successfully:

ronj@l:~$ appcfg.py update myapp/
03:03 PM Host: appengine.google.com
03:03 PM Application: myapp; version: 1
...
03:03 PM Completed update of app: myapp, version: 1

My app uses the Google API, so this deployment includes a client_secrets.json file, which lives at the root of my project folder. And it seems it is correctly deployed, because I get it when re-downloading my app (with appcfg.py download_app -A myapp -V 1 ~/myapp).

However, when opening a page that calls a script needing access to client_secrets.json, I get a Error: Server Error, and here is what the instance logs show (myapp and MYID censored):

Traceback (most recent call last):
  File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
    handler = __import__(path[0])
  File "/base/data/home/apps/s~myapp/1.MYID/myapp.py", line 42, in <module>
    YOUTUBE_READ_WRITE_SCOPE)
  File "/base/data/home/apps/s~myapp/1.MYID/oauth2client/util.py", line 128, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/base/data/home/apps/s~myapp/1.MYID/oauth2client/appengine.py", line 854, in __init__
    client_type, client_info = clientsecrets.loadfile(filename, cache=cache)
  File "/base/data/home/apps/s~myapp/1.MYID/oauth2client/clientsecrets.py", line 145, in loadfile
    return _loadfile(filename)
  File "/base/data/home/apps/s~myapp/1.MYID/oauth2client/clientsecrets.py", line 107, in _loadfile
    raise InvalidClientSecretsError('File not found: "%s"' % filename)
InvalidClientSecretsError: File not found: "/base/data/home/apps/s~myapp/1.MYID/client_secrets.json"

Here are lines 41 and 42 of myapp.py:

decorator = OAuth2DecoratorFromClientSecrets(CLIENT_SECRETS,
    YOUTUBE_READ_WRITE_SCOPE)

and here is CLIENT_SECRETS:

CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 'client_secrets.json')

What am I doing wrong?

EDIT: murph on #appengine mentioned that may come from incorrect app.yaml configuration, and that I should "Make sure it's not in app.yaml being served as a static file, and make sure any of your own code doesn't decide to serve it", but even after removing all static handlers to that file, the problem persists. Here's a pastebin to my app.yaml. And talking about that, I noticed that if I leave client_secrets.json and deploy, I see "Cloning 6 static files". Then if I delete it and re-deploy, I see "Cloning 5 static files". Does that confirm there is still something in my app.yaml that matches client_secrets.json, or are these separate mechanisms?

War es hilfreich?

Lösung

yes, the "js"on matches

- url: /(.*\.(gif|png|jpg|css|js|ico))
  static_files: \1
  upload: (.*\.(gif|png|jpg|css|js|ico))

Try this instead

- url: /(.*\.(gif|png|jpg|css|js|ico)$)
  static_files: \1
  upload: (.*\.(gif|png|jpg|css|js|ico)$)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top