6

I am a beginner to Google App Engine, as well as web-development in Python. After making a small Python based app, I have been trying for the past 6 days to get it uploaded on GAE. The "app.yaml" file below gives the error given after that.

APP.YAML (UPDATED)

application: web2py
version: 1
runtime: python27
api_version: 1
threadsafe: false

default_expiration: "24h"

handlers: 
- url: /(?P<a>.+?)/static/(?P<b>.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional

- url: /favicon.ico
  static_files: applications/welcome/static/favicon.ico
  upload: applications/welcome/static/favicon.ico

- url: /robots.txt
  static_files: applications/welcome/static/robots.txt
  upload: applications/welcome/static/robots.txt

- url: .*
#  script: gaehandler.py         # CGI
#  script: web2py.app # ?
  script: gaehandler.wsgiapp    # WSGI (Python 2.7 only)
  secure: optional

admin_console:
  pages:
  - name: Appstats
    url: /_ah/stats

skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 (applications/(admin|examples)/.*)|
 ((admin|examples)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/(rocket|winservice)\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$

builtins:
- remote_api: on
- appstats: on
- admin_redirect: on
- deferred: on

Google App Engine while using Python 2.7.3 gives the following Error

YAML ERROR on GAE

*** Running dev_appserver with the following flags:
    --admin_console_server= --port=8080 --use_sqlite
Python command: /usr/local/bin/python2.7
ERROR    2012-11-22 05:24:13,142 dev_appserver_main.py:626] Fatal error when loading application configuration:
mapping values are not allowed here
  in "/Applications/+++WWW+++/GAE/gae3web2py/app.yaml", line 9, column 9

If anyone can kindly help me, I shall be very thankful, especially on this day of American "Thanksgiving" ! ;-)


UPDATED

The "app.yaml" file was updated with the spacing as suggested. But it still gives that same error.

I even tried it here, where it gives the same errors: Link > http://yaml-online-parser.appspot.com/

4 Answers4

1

When configuring your app.yaml, you need to separate all parameters from their values with spaces (so application:web2py should be application: web2py, etc.). Try dropping a space in after the colons (specifically after this one: url:/(?P<a>.+?)/static/(?P<b>.+)) and see if that fixes the error.

RocketDonkey
  • 33,047
  • 7
  • 75
  • 83
  • Thank you, dear RocketDonkey! I tried your suggestions and updated the file, but still the errors as given above. PS: You have a very funny name. I am trying to imagine that. ;-) – PRACHI VAKHARIA Nov 22 '12 at 06:34
  • 1
    @zZz No problem - do you still get that same error? Pasting your yaml into to parser you linked seems to work fine, so happy to help debug further if necessary :) – RocketDonkey Nov 22 '12 at 06:37
  • Dear RocketDonkey, Thank you for the kind help. I am still trying out the GAE and the Python Framework, and I shall definitely keep you posted as to how things proceed and develop. – PRACHI VAKHARIA Nov 22 '12 at 17:35
  • @zZz Well good luck with everything! Did you get that error figured out? – RocketDonkey Nov 22 '12 at 17:37
  • The error is gone, but the simple application I wrote does not get uploaded on GAE still. I followed all the instructions in the web2py book & website, again and again. And many things seem to be missing in the instructions. It seems the author (creator) wrote it assuming many things, but I don't yet know what they are. – PRACHI VAKHARIA Nov 22 '12 at 18:05
  • @zZz Where are you running into errors? I'm sure we can get them figured out. – RocketDonkey Nov 22 '12 at 18:15
  • why not start with a simple *working* example and add your components to it's app.yaml until it breaks? http://code.google.com/p/google-app-engine-samples/ – Paul Collingwood Nov 22 '12 at 18:36
  • Agree with @PaulC - more efficient to start with something that works and see where it breaks. What does your web2py file contain? – RocketDonkey Nov 22 '12 at 19:54
  • I shall keep you updated as I resolve some of those issues, and I am trying GAE now with a bare-bones application with no DB, or anything. And that works now. And I am immediately posting this to share my joy at seeing it work on GAE. I shall share as I proceed, and I will share how the problems were/are resolved. Yay! – PRACHI VAKHARIA Nov 24 '12 at 20:26
  • 1
    @zZz Good to hear :) Also, if either of these answers helpecd (since they were basically the same), you can accept them by clicking the check mark below the answer score. Then you can ask new questions as they come up and get all kinds of new answers :) – RocketDonkey Nov 24 '12 at 20:28
1

It's an issue with your YAML syntax. If you're ever confused about the syntax, you can find the spec here..

From section 2.1 - Collections:

YAML’s block collections use indentation for scope and begin each entry on its own line. Block sequences indicate each entry with a dash and space ( “- ”). Mappings use a colon and space (“: ”) to mark each key: value pair. Comments begin with an octothorpe (also called a “hash”, “sharp”, “pound”, or “number sign” - “#”).

Aesthete
  • 17,256
  • 6
  • 32
  • 43
  • Thank you, dear Aesthete! I tried the suggestions given above by RocketDonkey, and updated the file, but still the errors as given above. I referred to the information you gave at that link, and if I can learn all that, I would have not been a newbie with these silly doubts about Spacing!!! ;-) – PRACHI VAKHARIA Nov 22 '12 at 06:36
1

Try removing all the succeeding space after :
This worked for me, although there were some other bugs in my app.yaml that I have not yet corrected.

Shashank Shekhar
  • 3,402
  • 2
  • 38
  • 49
0

I'm not sure what Google GAE uses to interpret the YAML file, but to PyYAML that file is not acceptable because of the \ in the value for static_files.

This also happens to be the 9th line of the file (leaving out empty lines). So I would start by escape those values.

Please note that http://yaml-online-parser.appspot.com/ now just parses your exmaple, but it silently seems to convert the \1 to '\2' before passing the data from the textarea to PyYAML.

Anthon
  • 51,019
  • 25
  • 150
  • 211