yaml包含谷歌应用引擎/ pyDev的处理程序

时间:2015-03-26 01:20:25

标签: google-app-engine include yaml pydev handlers

我想知道的是,如何让test.html(静态文件夹中的文件,前端包中的文件)出现?

我把它的处理程序放在include.yaml文件(静态文件夹之外的文件)中,并在app.yaml文件中的includes下面列出前端(前端程序包之外的文件)

我的目录如下所示:

    frontend (package)
        handlers (package in frontend)
            __init__.py (file in handlers)
        sass (folder in frontend)
        static (folder in frontend)
            test.html (file in static)
        __init__.py (file in frontend)
        include.yaml(file in frontend)
   app.yaml (file not in frontend)

// ================================

我的include.yaml(在前端包中)看起来像这样(是的,所有内容都被注释掉了,因为我尝试的都没有工作):

    handlers:

    #- url: /frontend/static
    #  static_dir: frontend/static ### this works in app.yaml, but does not work in this file

    #- url: /static
    #  static_dir: static ### doesn't work in this file

    #- url: /frontend/static
    #  static_dir: frontend.static ### doesn't work in this file

    #- url: /frontend/static
    #  static_dir: /frontend/static ### this does not work in app.yaml, or in this file

// ============================================= ==

我的app.yaml文件(不在前端包中,与它相同)看起来像这样:

application: edev
version: 1
runtime: python27
api_version: 1
threadsafe: true


includes:
 - frontend
#- frontend_admin
#- api
#- mapreduce


handlers:

#- url: /frontend/static
#  static_dir: frontend/static ### this works in app.yaml

#- url: /frontend/static
#  static_dir: /frontend/static ### this does not work in app.yaml

#- url: /
#  script: main.app

#- url: /_ah/warmup
#  script: warmup.application



#- url: /.*
#  script: main.app


builtins:
- remote_api: on

inbound_services:
- warmup

#skip_files:
#- ^(.*/)?#.*#$
#- ^(.*/)?.*~$
#- ^(.*/)?.*\.py[co]$
#- ^(.*/)?.*/RCS/.*$
#- ^(.*/)?\..*$
#- tools.*

libraries:
- name: webapp2
  version: "2.5.2"
- name: jinja2
  version: latest

思想?

1 个答案:

答案 0 :(得分:0)

对于我的appengine项目,我有一个名为statics.yaml的包含,看起来像这样。有了这个,我可以直接从?_?上下文提供文件。我希望你能在这里找到一些可以帮助你的东西,如果你只想提供一个静态文件,那么你应该能够在没有程序的情况下完成它,只需yaml和下面使用的静态目录。

handlers:
- url: /(robots\.txt|favicon\.ico)
  static_files: static/\1
  upload: static/.*

- url: /vi/(.*)\%7D%7D
  static_files: static/robots.txt
  upload: static/robots.txt

- url: /static
  static_dir: static

- url: /assets
  static_dir: assets

- url: /img
  static_dir: static/img

- url: /_
  static_dir: static

- url: /stylesheets
  static_dir: static/stylesheets

- url: /stylesheets/main.css
  static_files: stylesheets/main.css
  upload: stylesheets/main.css
- url: /stylesheets/facebook.css
  static_files: stylesheets/facebook.css
  upload: stylesheets/facebook.css
- url: /stylesheets/awesome-buttons.css
  static_files: stylesheets/awesome-buttons.css
  upload: stylesheets/awesome-buttons.css
- url: /stylesheets/kool.css
  static_files: stylesheets/kool.css
  upload: stylesheets/kool.css
- url: /stylesheets/a.css
  static_files: stylesheets/a.css
  upload: stylesheets/a.css
- url: /stylesheets/index.css
  static_files: stylesheets/index.css
  upload: stylesheets/index.css
- url: /stylesheets/1.css
  static_files: stylesheets/1.css
  upload: stylesheets/1.css
- url: /googleb4b3b9748fe57cbf.html
  static_files: static/googleb4b3b9748fe57cbf.html
  upload: static/googleb4b3b9748fe57cbf.html