我该如何编写我的Google App Engine app.yaml文件?

4
我注册了一个Google App Engine应用程序,下面有一些文件:
/index.html
/css/index.css
/js/index.js
/feedbacks/index.html
/feedbacks/css/index.css
/feedbacks/js/index.js
我该如何编写app.yaml文件?
谢谢!
2个回答

4
application: appname
version: 1
runtime: python
api_version: 1

handlers:

-   url: /favicon.ico
    static_files: img/favicon.ico
    upload: img/favicon.ico
    mime_type: image/x-icon

-   url: /css  #your css folder
    static_dir: css 

-   url: /scripts #your javascript folder
    static_dir: scripts


-   url: /img #your image folder
    static_dir: img

-   url: /.*
    script: your_script.py

0

将你的前三个文件放入一个名为 "static" 的文件夹中。

handlers:
-   url: /feedbacks/
    static_dir: feedbacks

-   url: /css/
    static_dir: static

-   url: /js/
    static_dir: static

-   url: /.*
    script: main.py

在你的 main.py 文件中。
class IndexHandler(webapp.RequestHandler):
    def get(self):
        self.redirect('static/index.html')


def main():
    application = webapp.WSGIApplication([
            ('/index.html', IndexHandler),
        ], debug=True)
    run_wsgi_app(application)

这种写法不是很好, 但可以解决你的问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接