开发者

How should I write my Google App Engine app.yaml file?

开发者 https://www.devze.com 2023-01-28 07:59 出处:网络
I registered a Google App Engine app and I have some files below: /index.html /css/index.css /js/index.js

I registered a Google App Engine app and I have some files below:

/index.html

/css/index.css

/js/index.js

/feedbacks/index.html

/feedbacks/css/index.css

/feedbacks/js/开发者_StackOverflow中文版index.js

How should I write the app.yaml file?

Thank you!


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


Put your first 3 files into a folder name "static"

handlers:
-   url: /feedbacks/
    static_dir: feedbacks

-   url: /css/
    static_dir: static

-   url: /js/
    static_dir: static

-   url: /.*
    script: main.py

In your 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)

It's not good to write in this way, but this will solve your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消