Python configuration file app. yaml

Source: Internet
Author: User

Google appengine uses an app. yaml as its important global configuration file. <Br/> each independent Google appengine application must declare such a file. </P> <p> app. yaml uses yaml as the format. People familiar with Ruby should be very familiar with the yaml format. </P> <p> required content <br/> in an app. in yaml, the following fields must be declared: </P> <p> application <br/> application is used to uniquely identify a Google appengine application. <Br/> In the development environment (using dev_appserver.py), this field is required, but its value is random. <Br/> but in the deployment environment (after the application is uploaded to the host of Google appengin), <br/> the value must be consistent with the application_id of the Google appengine you applied. </P> <p> application: MyApp <br/> version <br/> indicates the version of the Google appengine application. Similarly, in the development environment, this value is optional. </P> <p> runtime and api_version <br/> runtime and api_version indicate which version of the runtime environment the application depends on (api_version ). <Br/> currently, only python is supported, so these two values are fixed. </P> <p> runtime: python <br/> api_version: 1 <br/> handlers is used to define a series of URL handlers (similar to URL Mapping, if you are familiar with spring MVC ). <Br/> you need to assign a URL pattern for each handler (you can use a regular expression ). <Br/> once the requested URL meets the pattern, appengine submits the request to the handler object for processing. </P> <p> when processing dynamic content, use the script field. The script defines the python file path used to process the request. </P> <p> handlers: <br/>-URL :/. * <br/> Script: Main. PY <br/>-URL:/book /. * <br/> Script: Book. PY <br/> Google appengine uses the first-match priority principle when matching URL pattern. Therefore, in the above configuration, Book. py will never be used. </P> <p> Of course, you can also use <code> handler </code> to process static content, such as JavaScript scripts or CSS files. </P> <p>-URL:/JS <br/> static_dir:/path/to/jsfolder <br/>-URL:/CSS <br/> static_dir: /path/to/cssfolder <br/> static_dir indicates the directory where the static file is located. <Br/> therefore, for/JS/book/Main. js requests, Google appengine searches for/path/to/jsfolder/book/Main. js.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.