【问题标题】:yaml include handlers for google app engine / pyDevyaml 包含 google app engine / pyDev 的处理程序
【发布时间】:2015-05-29 22:32:26
【问题描述】:

我只想知道,如何让 test.html(静态文件夹中的一个文件,在前端包中)显示出来?

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

我的目录如下所示:

    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

想法?

【问题讨论】:

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


    【解决方案1】:

    对于我的 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
    

    【讨论】:

      猜你喜欢
      • 2011-03-21
      • 2017-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 1970-01-01
      • 1970-01-01
      • 2019-05-24
      相关资源
      最近更新 更多