简体   繁体   中英

How to link script directory in App Engine for python?

I have file app.yaml:

application: v2011
version: 1
runtime: python
api_version: 1

handlers:
- url: /stylesheets
  static_dir: stylesheets

- url: /.*
  script: helloworld.py

When i try to add:

application: v2011
version: 1
runtime: python
api_version: 1

handlers:
- url: /stylesheets
  static_dir: stylesheets

  - url: /scripts
  static_dir: scripts

- url: /.*
  script: helloworld.py

It just can not display content of linked javascript file. In python file it is defined as <script type="text/javascript" src="/scripts/java.js"></script> What is wrong?

A sample code below. It does a pattern matching and if found, looks for file in the static/ folder. The url is http://app-id.appspot.com/my-script.js - also check the logs output at appengine.google.com, posting that error message here helps too.

handlers:
- url: /(.*\.(html|css|js|gif|jpg|png|ico))
  static_files: static/\1
  upload: static/.*
  expiration: "1d"

btw, you may want to try the new python 2.7 while you are at it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM