[英]Python deploy to Google App Engine
I am trying python project deploy to GAE. 我正在尝试将python项目部署到GAE。 But I am giving this error message "Line 14, column 1: Expected scalar for String type but found: sequence start"
但我给出此错误消息“第14行,第1列:字符串类型的预期标量,但发现:序列开始”
can you help me please 你能帮我吗
app.yaml 的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 include.yaml文件内容在这里
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
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 标量是一个“单一”值 - 整数,布尔值,也许是一个字符串
expiration
呼气
Optional.
可选的。 The length of time a static file served by this handler ought to be cached by web proxies and browsers.
此处理程序提供的静态文件的时间长度应由Web代理和浏览器缓存。 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, ands
for seconds.该值是一个由空格分隔的数字和单位 的字符串 ,其中单位可以是
d
表示天数,h
表示小时数,m
表示分钟数,s
表示秒数。 For example,"4d 5h"
sets cache expiration to 4 days and 5 hours after the file is first requested.例如,
"4d 5h"
将缓存过期设置为首次请求文件后的4天和5小时。 See Static cache expiration.请参阅静态缓存过期。 If omitted, the application's default_expiration is used.
如果省略,则使用应用程序的default_expiration。
Inspecting your files 检查您的文件
At several points in ferris/include.yaml you have blocks like this that use expiration
在ferris / include.yaml的几个点,你有这样的块使用
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. 在阅读了文档后,我们知道它需要一个字符串(这是一个标量类型)并且你给它
7d
,它应该识别为错误中提到的序列开始 。
Solution 解
The solution should be as simple as changing all values for expiration
to be strings, for example 例如,解决方案应该像将
expiration
所有值更改为字符串一样简单
- url: /ferris/fonts
static_dir: ferris/static/fonts
expiration: "7d"
Note the inserted double quotes. 请注意插入的双引号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.