在Google应用引擎Python中提供静态html [英] Serving static html in Google app engine Python
问题描述
我无法获取为我的Python
应用程序加载的静态 .html
页面。当我点击像 index.html 这样的链接时,我收到一个空白页面,并在服务器上记录一个404错误。对于其他静态 .html
文件(如 about.html ),这是相同的。
应用程序工作栏中的静态文件。我试过在
的许多地方查看,但我似乎无法获得.html页面。即
INFO 2011-04-16 17:26:33,655 dev_appserver.py:3317]GET /
terms.html HTTP / 1.1404 -
yaml:
应用程序:报价
版本:1
运行时:python
api_version:1
处理程序:
- url:/index\.html
script:index.py
- url:/
script:index.py
- url:/(.*\.html))
static_files:static / \ 1
upload:static / HTML /(.* \。(html))
$ b $ - url:/favicon.ico
static_files:static / images / favicon.ico
上传:images / favicon.ico
mime_type:image / x-icon
$ b $ url - / css
static_dir:static / css
$ b $ - url:/ images
static_dir:static / images
- url:/ js
static_dir:static / js
我的静态文件位于in static / HTML and index.html 位于主文件夹中。
我也试过了是,但它似乎没有什么区别:
- url:/favicon.ico
static_files:static /images/favicon.ico
上传:images / favicon.ico
mime_type:image / x-icon
- url:/ css
static_dir:static / css
$ b $ url - / images
static_dir:static / images
$ b $ - url:/ js
static_dir:static / js
- url:/(.*\.html))
static_files:static / \ 1
upload:static / HTML /(.* \。(html))
- url:/index\\.html
script:index.py
- url:/
script:index.py
code>
将HandlerScripts放在静态目录处理部分的下方。 IOW,把它移到最后。
- url:/index\\.html
script:index。 py
- url:/
script:index.py
I'm having trouble getting static .html
pages loaded for my Python
app. When I click on a link like index.html, I get a blank page and on the server log a 404 error. This is the same for other static .html
files such as about.html.
The application works bar the static files. I've tried looking in numerous places, but I cannot seem to get the .html pages up. i.e.
INFO 2011-04-16 17:26:33,655 dev_appserver.py:3317] "GET / terms.html HTTP/1.1" 404 -
yaml:
application: quote
version: 1
runtime: python
api_version: 1
handlers:
- url: /index\.html
script: index.py
- url: /
script: index.py
- url: /(.*\.(html))
static_files: static/\1
upload: static/HTML/(.*\.(html))
- url: /favicon.ico
static_files: static/images/favicon.ico
upload: images/favicon.ico
mime_type: image/x-icon
- url: /css
static_dir: static/css
- url: /images
static_dir: static/images
- url: /js
static_dir: static/js
My static files are located in static/HTML and index.html is in the main folder.
I have also tried this, but it seems to make no difference at all:
- url: /favicon.ico
static_files: static/images/favicon.ico
upload: images/favicon.ico
mime_type: image/x-icon
- url: /css
static_dir: static/css
- url: /images
static_dir: static/images
- url: /js
static_dir: static/js
- url: /(.*\.(html))
static_files: static/\1
upload: static/HTML/(.*\.(html))
- url: /index\.html
script: index.py
- url: /
script: index.py
Keep your HandlerScripts below the Static Directory handling portion. IOW, just move this to the last.
- url: /index\.html
script: index.py
- url: /
script: index.py
这篇关于在Google应用引擎Python中提供静态html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!