I'm attempting to create endpoints for my google-app-engine in Python. I've followed the directions on https://developers.google.com/appengine/docs/python/endpoints/ and when I attempt to upload I am getting the following message:
Host: appengine.google.com Error parsing yaml file: the library
"endpoints" is not supported in "guestbook/app.yaml", line 22,
column 1
I believe I've got everything configured correctly, can anyone point me in the right direction? I believe having the library import for "endpoints" is critical for this to function.
Here is my app.yaml file:
application: xxxxxxx
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /_ah/spi/.*
script: enders.application
- url: /stylesheets
static_dir: stylesheets
- url: /.*
script: main.app
secure: always
libraries:
- name: endpoints
version: "1.0"
- name: pycrypto
version: "2.6"
- name: webapp2
version: latest
- name: jinja2
version: latest
Make sure you're using the most recent version of the AppEngine SDK. Cloud Endpoints was moved to a library in version 1.8.5.
lucemia pushed me down the right path. I had two versions of the SDK so I removed the older version and voila, problem solved.
Related
Following error as shown in screen-shot,occurs when i try to run my helloworld.py script in Google App engine from terminal.
#My Operating system:Ubuntu.14.#
And Here is my file app.yaml.
application: #My project Id.
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /static
static_dir: static
- url: /
static_files: static/index.html
upload: static/index\.html
secure: always
- url: /_ah/spi/.*
script: helloworld_api.app
libraries:
- name: endpoints
version: 1.0
The Problem is that i can't deploy my code on local machine.
Any helps would be Appreciated.Thanks :)
I had check Online Yaml parser and it shows its Valid too.
You're missing the libraries line, the endpoints library are actually interpreted as part of the handlers list, which is incorrect.
Should look like this:
...
- url: /_ah/spi/.*
script: helloworld_api.app
libraries:
- name: endpoints
version: 1.0
I am successfully using Pycrypto vs. 2.6 in my GAE development environment under Python 2.7. However, deploying it to Google production I see the following error in the logs:
from Crypto.Cipher import _AES ImportError: cannot import name _AES
My App.Yaml:
application: appname
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.app
secure: always
libraries:
- name: webapp2
version: "2.5.2"
- name: pycrypto
version: "2.6"
The Python call in question:
from Crypto.Cipher import AES
Checking Google support documents and they do list Pycrypto 2.6 as supported. I also tried to enter "latest" for the version and received the same error. Again in development GAE on my local machine it works perfectly.
Issue resolved. I had a directory from my Windows installation called "Crypto" in my App Engine project directory. When the app loader loaded the files it also included this directory which conflicted with what Google has loaded in production. Removal of this directory from the local project directory resolved the problem upon the next push to Google.
I have this app.yaml:
application: xyz
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /static
static_dir: static
- url: /admin/.*
script: admin.app
login: admin
- url: /.*
script: main.app
libraries:
- name: webapp2
version: latest
- name: jinja2
version: latest
when I access /admin/, both the dev server and appengine display the contents without asking for authentication. What gives?
I've run into this before. Try clearing your cookies. Clearing the cookies also helps if you accidentally forgot to check "log in as administrator" when the dev server prompts you for the fake login info.
I'm working on my first GAE project and I'm having some trouble getting custom pages to show up in the Admin Console. I'm following the Google Docs on it, but it doesn't seem to be working for me. I have a feeling it could have something to do with this note:
Note: Only custom pages defined by the default version will be shown
in the Admin Console.
but I'm not entirely sure what they mean (the default version of the app?).
The page URLs work fine if I visit them directly, but the links will not show in the Admin Console sidebar.
YAML:
application: namegenerator
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /css
static_dir: css
- url: /admin/.*
script: main.app
login: admin
- url: /.*
script: main.app
libraries:
- name: jinja2
version: latest
builtins:
- remote_api: on
admin_console:
pages:
- name: Manual DB Entry
url: /admin/db/add
- name: Clear DB
url: /admin/db/clear
Python routing:
app = webapp2.WSGIApplication([('/', MainHandler),
('/vote', SubmitVote),
('/clear_session', ClearUserSession),
('/admin/db/clear', ClearDatabase),
('/admin/db/add', ManualAddToDatabase)],
debug=True)
This is all being tested and run on my local machine, by the way. Thanks for any help.
Your code looks fine to me. Did you deploy your application? I think the admin pages will not be shown in your SDK.
By the way: An administrator can change which major deployed version of the application is default using Administration Console: https://appengine.google.com/
I am using flask and the python 2.7 GAE SDK. I am trying to include an interactive shell, in my app.
I am trying to include the following interactive python shell in my app, so that I can interact with the GAE API while development - http://code.google.com/p/google-app-engine-samples/source/browse/trunk/shell/
As instructed I have copied the static/ and templates/ folders, and shell.py to the root of my app.
I have also added the url route ONLY to my app.yaml (shell)-
application: myflaskonappengineapp
version: 1
runtime: python27
api_version: 1
threadsafe: false
default_expiration: "5d"
builtins:
- appstats: on
- admin_redirect: on
- deferred: on
- remote_api: on
libraries:
- name: jinja2
version: "2.6"
- name: markupsafe
version: "0.15"
- name: lxml
version: "2.3"
- name: numpy
version: "1.6.1"
- name: PIL
version: "1.1.7"
- name: pycrypto
version: "2.3"
- name: setuptools
version: "0.6c11"
- name: webapp2
version: "2.3"
- name: webob
version: "1.1.1"
- name: yaml
version: "3.10"
inbound_services:
- warmup
handlers:
- url: /favicon.ico
static_files: application/static/img/favicon.ico
upload: application/static/img/favicon.ico
- url: /robots.txt
static_files: application/static/robots.txt
upload: application/static/robots.txt
- url: /_gae_mini_profiler/static
static_dir: packages/flaskext/gae_mini_profiler/static
- url: /static
static_dir: application/static
#interactive shell
- url: /shell
script: shell.py
- url: /remote_api
script: /opt/google_appengine/google/appengine/ext/remote_api/handler.py
- url: .*
script: application.app
However when I try to access the url /shell, I get a 404 error ? Do I need to configure flask also for routing ? Why is flask handling this url instead of shell.py?
You need to modify the shell.py to handle the URL '/shell' as well as app.yaml.
In particular, you need to edit the line 303 of the shell.py.
from
[('/', FrontPageHandler),
to
[('/shell', FrontPageHandler),
You also need to update your app.yaml like(add wildcard):
- url: /shell.*
script: shell.py
Please consider adding login:admin to the shell handler, otherwise you will open up the shell capability to everyone in the world.