1

I am trying python project deploy to GAE. But I am giving this error message "Line 14, column 1: Expected scalar for String type but found: sequence start"

can you help me please

app.yaml

application: app_name    #.appspot.com
version: baseline

runtime: python27
api_version: 1
threadsafe: yes 

default_expiration: 1h

builtins:
# Deferred is built in to Ferris. Do not enable it, it may lead to import errors.
- appstats: on  # Also turn on appstats in settings.py

includes:
- ferris/include.yaml
# If plugins require inculdes, put them here.

libraries:
- name: jinja2
  version: latest
- name: lxml
  version: latest
- name: webapp2
  version: latest
- name: webob
  version: latest

skip_files:
- ^(.*/)?app\.ya?ml
- ^(.*/)?index\.ya?ml
- ^(.*/)?#.*#
- ^(.*/)?.*~
- ^(.*/)?.*\.py[co]
- ^(.*/)?.*/RCS/.*
- ^(.*/)?\..*
- ^(.*/)?.*\.scss
- ^(.*/)?.*\.less
- ^/docs*

handlers:
# Main script
- url: .*
  script: main.main_app
  login: required

include.yaml file content is here

handlers:
# Static resources
- url: /static
  static_dir: app/static

- url: /css
  static_dir: app/static/css

- url: /js
  static_dir: app/static/js

- url: /img
  static_dir: app/static/img

# Ferris static resources
- url: /ferris/static
  static_dir: ferris/static
  expiration: 7d

- url: /ferris/css
  static_dir: ferris/static/css
  expiration: 7d

- url: /ferris/js
  static_dir: ferris/static/js
  expiration: 7d

- url: /ferris/img
  static_dir: ferris/static/img
  expiration: 7d

- url: /ferris/fonts
  static_dir: ferris/static/fonts
  expiration: 7d

# Top-level static files
- url: /favicon\.ico
  static_files: app/static/favicon.ico
  upload: app/static/favicon\.ico
  expiration: 7d

- url: /robots\.txt
  static_files: app/static/robots.txt
  upload: app/static/robots\.txt
  expiration: 7d

- url: /humans\.txt
  static_files: app/static/humans.txt
  upload: app/static/humans\.txt
  expiration: 7d

# Maps plugins/{plugin}/static to /plugins/{plugin} 
- url: /plugins/(.*?)/(.*)
  static_files: plugins/\1/static/\2
  upload: plugins/(.*?)/static/(.*)

# Cron prefix is admin-only.
- url: /cron/.*
  script: main.main_app
  login: admin

# Used to fix imports before running deffered tasks.
- url: /_ah/queue/deferred
  script: main.deferred_app
  login: admin
hiwordls
  • 781
  • 7
  • 17
  • 35

1 Answers1

3

Inspecting the error

Expected scalar for String type but found: sequence start"

What is a scalar type?
A scalar is a "single" value - integer, boolean, perhaps a string


Checking the docs

expiration

Optional. The length of time a static file served by this handler ought to be cached by web proxies and browsers. The value is a string of numbers and units, separated by spaces, where units can be d for days, h for hours, m for minutes, and s for seconds. For example, "4d 5h" sets cache expiration to 4 days and 5 hours after the file is first requested. See Static cache expiration. If omitted, the application's default_expiration is used.


Inspecting your files

At several points in ferris/include.yaml you have blocks like this that use expiration

- url: /ferris/fonts
  static_dir: ferris/static/fonts
  expiration: 7d

After having read the docs we know it expects a string (which is a scalar type) and you are giving it 7d which it supposedly recognizes as a sequence start as mentioned in the error.


Solution

The solution should be as simple as changing all values for expiration to be strings, for example

- url: /ferris/fonts
  static_dir: ferris/static/fonts
  expiration: "7d"

Note the inserted double quotes.

Community
  • 1
  • 1
Tim
  • 41,901
  • 18
  • 127
  • 145